Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haihang
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐丛奇
haihang
Commits
5480d6e2
Commit
5480d6e2
authored
Sep 07, 2018
by
徐丛奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aaaaaaaaaaaaaaaa
parent
ded2553a
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
841 additions
and
85 deletions
+841
-85
build.gradle
app/build.gradle
+2
-0
BeforeEyeTestActivity.java
app/src/main/java/com/oo/eye/activity/BeforeEyeTestActivity.java
+1
-0
EyeTestActivity.java
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
+48
-2
EyeTestMainActivity.java
app/src/main/java/com/oo/eye/activity/EyeTestMainActivity.java
+12
-2
ClassBean.java
app/src/main/java/com/oo/eye/bean/ClassBean.java
+20
-1
Eye.java
app/src/main/java/com/oo/eye/bean/Eye.java
+1
-0
StudentBean.java
app/src/main/java/com/oo/eye/bean/StudentBean.java
+38
-0
DbManager.java
app/src/main/java/com/oo/eye/db/DbManager.java
+86
-80
ClassBeanDao.java
app/src/main/java/com/oo/eye/gen/ClassBeanDao.java
+196
-0
DaoMaster.java
app/src/main/java/com/oo/eye/gen/DaoMaster.java
+99
-0
DaoSession.java
app/src/main/java/com/oo/eye/gen/DaoSession.java
+62
-0
StudentBeanDao.java
app/src/main/java/com/oo/eye/gen/StudentBeanDao.java
+276
-0
No files found.
app/build.gradle
View file @
5480d6e2
...
@@ -37,4 +37,6 @@ dependencies {
...
@@ -37,4 +37,6 @@ dependencies {
compile
project
(
':library:netlibrary'
)
compile
project
(
':library:netlibrary'
)
compile
'com.jakewharton:butterknife:8.6.0'
compile
'com.jakewharton:butterknife:8.6.0'
apt
'com.jakewharton:butterknife-compiler:8.6.0'
apt
'com.jakewharton:butterknife-compiler:8.6.0'
//数据库
compile
'org.greenrobot:greendao:3.2.2'
}
}
app/src/main/java/com/oo/eye/activity/BeforeEyeTestActivity.java
View file @
5480d6e2
...
@@ -43,6 +43,7 @@ public class BeforeEyeTestActivity extends BaseActivity {
...
@@ -43,6 +43,7 @@ public class BeforeEyeTestActivity extends BaseActivity {
mLlBeforeEyeStart1
.
setVisibility
(
View
.
GONE
);
mLlBeforeEyeStart1
.
setVisibility
(
View
.
GONE
);
mLlBeforeEyePrepare1
.
setVisibility
(
View
.
VISIBLE
);
mLlBeforeEyePrepare1
.
setVisibility
(
View
.
VISIBLE
);
Intent
intent2
=
new
Intent
(
BeforeEyeTestActivity
.
this
,
EyeTestActivity
.
class
);
Intent
intent2
=
new
Intent
(
BeforeEyeTestActivity
.
this
,
EyeTestActivity
.
class
);
intent2
.
putExtra
(
"isTemporary"
,
getIntent
().
getBooleanExtra
(
"isTemporary"
,
false
));
startActivity
(
intent2
);
startActivity
(
intent2
);
finish
();
finish
();
}
}
...
...
app/src/main/java/com/oo/eye/activity/EyeTestActivity.java
View file @
5480d6e2
package
com
.
oo
.
eye
.
activity
;
package
com
.
oo
.
eye
.
activity
;
import
android.os.Build
;
import
android.os.CountDownTimer
;
import
android.os.CountDownTimer
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
...
@@ -16,24 +17,33 @@ import com.app.baselibrary.commonUtil.BDttsUtils;
...
@@ -16,24 +17,33 @@ import com.app.baselibrary.commonUtil.BDttsUtils;
import
com.app.baselibrary.commonUtil.CheckUtil
;
import
com.app.baselibrary.commonUtil.CheckUtil
;
import
com.app.baselibrary.commonUtil.LogUtil
;
import
com.app.baselibrary.commonUtil.LogUtil
;
import
com.app.baselibrary.commonUtil.PreferencesUtils
;
import
com.app.baselibrary.commonUtil.PreferencesUtils
;
import
com.app.baselibrary.commonUtil.ToastUtil
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.R
;
import
com.oo.eye.R
;
import
com.oo.eye.bean.Eye
;
import
com.oo.eye.bean.Eye
;
import
com.oo.eye.bean.Eye.E
;
import
com.oo.eye.bean.Eye.E
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.eye.db.DbManager
;
import
com.oo.eye.net.EyeDataManager
;
import
com.oo.eye.widget.AfterTestDialog
;
import
com.oo.eye.widget.AfterTestDialog
;
import
com.oo.seex.netlibrary.net.response.OldResponseImpl
;
import
com.oo.seex.netlibrary.net.response.RxCallback
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.Random
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
import
butterknife.OnClick
;
import
rx.android.schedulers.AndroidSchedulers
;
import
static
com
.
oo
.
eye
.
EyeConfig
.
EYE_DIRECTION_4
;
import
static
com
.
oo
.
eye
.
EyeConfig
.
EYE_DIRECTION_4
;
import
static
com
.
oo
.
eye
.
EyeConfig
.
EYE_SETTING_5
;
import
static
com
.
oo
.
eye
.
EyeConfig
.
EYE_SETTING_5
;
import
static
com
.
oo
.
eye
.
bean
.
Eye
.
getIndexByValue
;
import
static
com
.
oo
.
eye
.
bean
.
Eye
.
getLineSumByIndex
;
import
static
com
.
oo
.
eye
.
bean
.
Eye
.
getLineSumByIndex
;
/**
/**
...
@@ -104,6 +114,8 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -104,6 +114,8 @@ public class EyeTestActivity extends BaseActivity {
private
AfterTestDialog
mAfterTestDialog
;
private
AfterTestDialog
mAfterTestDialog
;
private
boolean
isTemporary
;
@Override
@Override
protected
int
getLayoutId
()
{
protected
int
getLayoutId
()
{
return
R
.
layout
.
activity_eye_test
;
return
R
.
layout
.
activity_eye_test
;
...
@@ -122,7 +134,7 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -122,7 +134,7 @@ public class EyeTestActivity extends BaseActivity {
mDirection
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
EYE_DIRECTION_4
);
mDirection
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_DIRECTION_SETTING_KEY
,
EYE_DIRECTION_4
);
mGroupDecimal
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_SETTING_KEY
,
EyeConfig
.
EYE_SETTING_5
);
mGroupDecimal
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_SETTING_KEY
,
EyeConfig
.
EYE_SETTING_5
);
mAutoJudge
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_WAIT_SETTING_KEY
,
0
);
mAutoJudge
=
PreferencesUtils
.
getInt
(
EyeConfig
.
EYE_WAIT_SETTING_KEY
,
0
);
isTemporary
=
getIntent
().
getBooleanExtra
(
"isTemporary"
,
false
);
mList
.
clear
();
mList
.
clear
();
for
(
int
i
=
0
;
i
<
14
;
i
++)
{
for
(
int
i
=
0
;
i
<
14
;
i
++)
{
mList
.
add
(
initLineList
(
i
));
mList
.
add
(
initLineList
(
i
));
...
@@ -212,7 +224,7 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -212,7 +224,7 @@ public class EyeTestActivity extends BaseActivity {
}
}
}
}
}
}
mLevelIndex
=
Eye
.
getIndexByValue
(
e
,
true
)
-
1
;
mLevelIndex
=
getIndexByValue
(
e
,
true
)
-
1
;
nextE
(
true
);
nextE
(
true
);
}
}
}.
start
();
}.
start
();
...
@@ -550,7 +562,41 @@ public class EyeTestActivity extends BaseActivity {
...
@@ -550,7 +562,41 @@ public class EyeTestActivity extends BaseActivity {
isShow
=
true
;
isShow
=
true
;
nextName
=
mStudentList
.
get
(
next
).
getRealname
();
nextName
=
mStudentList
.
get
(
next
).
getRealname
();
}
}
double
left
=
mLeftEye
;
double
right
=
mRightEye
;
if
(
mGroupDecimal
!=
EyeConfig
.
EYE_SETTING_5
){
int
leftIndex
=
Eye
.
getIndexByValue
(
mLeftEye
,
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
left
=
Eye
.
getLevelByIndex
(
leftIndex
,
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
int
rightIndex
=
Eye
.
getIndexByValue
(
mRightEye
,
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
right
=
Eye
.
getLevelByIndex
(
rightIndex
,
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
);
}
if
(
isTemporary
){
measureStudent
.
setLeft_eye
(
left
);
measureStudent
.
setRight_eye
(
right
);
DbManager
.
getDaoSession
(
EyeTestActivity
.
this
).
insert
(
measureStudent
);
}
else
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"sid"
,
measureStudent
.
getSid
());
map
.
put
(
"uid"
,
measureStudent
.
getUid
());
map
.
put
(
"eid"
,
"0"
);
map
.
put
(
"left_eye"
,
""
+
left
);
map
.
put
(
"right_eye"
,
""
+
right
);
map
.
put
(
"distance"
,
""
+(
mDistance
==
EyeConfig
.
EYE_DISTANCE_5
?
5
:
2.5
)
);
map
.
put
(
"deviceId"
,
Build
.
ID
);
map
.
put
(
"pid"
,
measureStudent
.
getPid
());
EyeDataManager
.
getInstance
().
postEyeTestData
(
map
).
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
new
RxCallback
<
OldResponseImpl
<
String
>>()
{
@Override
protected
void
onSuccess
(
OldResponseImpl
<
String
>
stringOldResponse
)
{
ToastUtil
.
showLongMessage
(
"视力数据保存成功"
);
}
@Override
protected
void
onError
(
int
errorCode
,
String
errorMessage
)
{
ToastUtil
.
showLongMessage
(
"视力数据保存失败"
);
}
});
}
mAfterTestDialog
=
new
AfterTestDialog
.
Builder
(
EyeTestActivity
.
this
,
R
.
style
.
style_common_dialog
)
mAfterTestDialog
=
new
AfterTestDialog
.
Builder
(
EyeTestActivity
.
this
,
R
.
style
.
style_common_dialog
)
.
setLeftEye
(
""
+
mLeftEye
)
.
setLeftEye
(
""
+
mLeftEye
)
.
setRightEye
(
""
+
mRightEye
)
.
setRightEye
(
""
+
mRightEye
)
...
...
app/src/main/java/com/oo/eye/activity/EyeTestMainActivity.java
View file @
5480d6e2
package
com
.
oo
.
eye
.
activity
;
package
com
.
oo
.
eye
.
activity
;
import
android.content.Intent
;
import
android.view.MotionEvent
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
...
@@ -11,8 +12,11 @@ import com.app.baselibrary.commonUtil.ToastUtil;
...
@@ -11,8 +12,11 @@ import com.app.baselibrary.commonUtil.ToastUtil;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.EyeConfig
;
import
com.oo.eye.R
;
import
com.oo.eye.R
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.eye.db.DbManager
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
import
butterknife.OnClick
;
...
@@ -36,6 +40,8 @@ public class EyeTestMainActivity extends BaseActivity {
...
@@ -36,6 +40,8 @@ public class EyeTestMainActivity extends BaseActivity {
@BindView
(
R
.
id
.
lin_eye_test_setting
)
@BindView
(
R
.
id
.
lin_eye_test_setting
)
LinearLayout
mLinEyeTestSetting
;
LinearLayout
mLinEyeTestSetting
;
private
SimpleDateFormat
mSimpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
private
boolean
isRequestFinish
=
false
;
private
boolean
isRequestFinish
=
false
;
@Override
@Override
...
@@ -86,12 +92,16 @@ public class EyeTestMainActivity extends BaseActivity {
...
@@ -86,12 +92,16 @@ public class EyeTestMainActivity extends BaseActivity {
startActivity
(
MorePeopleTestActivity
.
class
);
startActivity
(
MorePeopleTestActivity
.
class
);
break
;
break
;
case
R
.
id
.
lin_eye_test_statistics
:
case
R
.
id
.
lin_eye_test_statistics
:
long
count
=
DbManager
.
getDaoSession
(
EyeTestMainActivity
.
this
).
getStudentBeanDao
().
count
();
ArrayList
<
StudentBean
>
list
=
new
ArrayList
<>();
ArrayList
<
StudentBean
>
list
=
new
ArrayList
<>();
StudentBean
student
=
new
StudentBean
();
StudentBean
student
=
new
StudentBean
();
student
.
setRealname
(
"游客"
);
student
.
setRealname
(
"游客"
+(
count
+
1
));
student
.
setClasses
(
mSimpleDateFormat
.
format
(
new
Date
()));
list
.
add
(
student
);
list
.
add
(
student
);
EyeConfig
.
getInstance
().
setStudents
(
list
);
EyeConfig
.
getInstance
().
setStudents
(
list
);
startActivity
(
BeforeEyeTestActivity
.
class
);
Intent
intent
=
new
Intent
(
EyeTestMainActivity
.
this
,
BeforeEyeTestActivity
.
class
);
intent
.
putExtra
(
"isTemporary"
,
true
);
startActivity
(
intent
);
break
;
break
;
case
R
.
id
.
lin_eye_test_setting
:
//测试报表
case
R
.
id
.
lin_eye_test_setting
:
//测试报表
startActivity
(
TestResurtListActivity
.
class
);
startActivity
(
TestResurtListActivity
.
class
);
...
...
app/src/main/java/com/oo/eye/bean/ClassBean.java
View file @
5480d6e2
...
@@ -2,10 +2,13 @@ package com.oo.eye.bean;
...
@@ -2,10 +2,13 @@ package com.oo.eye.bean;
import
com.app.baselibrary.bean.BaseBean
;
import
com.app.baselibrary.bean.BaseBean
;
import
org.greenrobot.greendao.annotation.Entity
;
import
org.greenrobot.greendao.annotation.Generated
;
/**
/**
* Created by xucon on 2018/8/31.
* Created by xucon on 2018/8/31.
*/
*/
@Entity
public
class
ClassBean
extends
BaseBean
{
public
class
ClassBean
extends
BaseBean
{
private
String
id
;
private
String
id
;
private
String
sid
;
private
String
sid
;
...
@@ -15,6 +18,22 @@ public class ClassBean extends BaseBean{
...
@@ -15,6 +18,22 @@ public class ClassBean extends BaseBean{
private
String
orderlist
;
private
String
orderlist
;
private
String
password
;
private
String
password
;
@Generated
(
hash
=
1216835192
)
public
ClassBean
(
String
id
,
String
sid
,
String
grade
,
String
classes
,
String
status
,
String
orderlist
,
String
password
)
{
this
.
id
=
id
;
this
.
sid
=
sid
;
this
.
grade
=
grade
;
this
.
classes
=
classes
;
this
.
status
=
status
;
this
.
orderlist
=
orderlist
;
this
.
password
=
password
;
}
@Generated
(
hash
=
1395092832
)
public
ClassBean
()
{
}
public
String
getPassword
()
{
public
String
getPassword
()
{
return
password
;
return
password
;
}
}
...
...
app/src/main/java/com/oo/eye/bean/Eye.java
View file @
5480d6e2
...
@@ -283,6 +283,7 @@ public class Eye extends BaseBean {
...
@@ -283,6 +283,7 @@ public class Eye extends BaseBean {
return
1.0
;
return
1.0
;
}
}
/**
/**
* 测量的对照表
* 测量的对照表
* @param value
* @param value
...
...
app/src/main/java/com/oo/eye/bean/StudentBean.java
View file @
5480d6e2
...
@@ -3,9 +3,13 @@ package com.oo.eye.bean;
...
@@ -3,9 +3,13 @@ package com.oo.eye.bean;
import
com.app.baselibrary.bean.BaseBean
;
import
com.app.baselibrary.bean.BaseBean
;
import
org.greenrobot.greendao.annotation.Entity
;
import
org.greenrobot.greendao.annotation.Generated
;
/**
/**
* Created by henry 16/1/30.
* Created by henry 16/1/30.
*/
*/
@Entity
public
class
StudentBean
extends
BaseBean
{
public
class
StudentBean
extends
BaseBean
{
private
String
sid
;
private
String
sid
;
private
String
uid
;
private
String
uid
;
...
@@ -23,6 +27,32 @@ public class StudentBean extends BaseBean {
...
@@ -23,6 +27,32 @@ public class StudentBean extends BaseBean {
private
boolean
isChick
;
private
boolean
isChick
;
private
String
birthday
;
private
String
birthday
;
@Generated
(
hash
=
1107237120
)
public
StudentBean
(
String
sid
,
String
uid
,
String
school
,
String
grade
,
String
classes
,
String
status
,
String
realname
,
String
number
,
double
left_eye
,
double
right_eye
,
String
url
,
String
pid
,
int
distance
,
boolean
isChick
,
String
birthday
)
{
this
.
sid
=
sid
;
this
.
uid
=
uid
;
this
.
school
=
school
;
this
.
grade
=
grade
;
this
.
classes
=
classes
;
this
.
status
=
status
;
this
.
realname
=
realname
;
this
.
number
=
number
;
this
.
left_eye
=
left_eye
;
this
.
right_eye
=
right_eye
;
this
.
url
=
url
;
this
.
pid
=
pid
;
this
.
distance
=
distance
;
this
.
isChick
=
isChick
;
this
.
birthday
=
birthday
;
}
@Generated
(
hash
=
2097171990
)
public
StudentBean
()
{
}
public
boolean
isChick
()
{
public
boolean
isChick
()
{
return
isChick
;
return
isChick
;
}
}
...
@@ -179,4 +209,12 @@ public class StudentBean extends BaseBean {
...
@@ -179,4 +209,12 @@ public class StudentBean extends BaseBean {
student
.
setDistance
(
measureDis
);
student
.
setDistance
(
measureDis
);
return
student
;
return
student
;
}
}
public
boolean
getIsChick
()
{
return
this
.
isChick
;
}
public
void
setIsChick
(
boolean
isChick
)
{
this
.
isChick
=
isChick
;
}
}
}
app/src/main/java/com/oo/eye/db/DbManager.java
View file @
5480d6e2
package
com
.
oo
.
eye
.
db
;
package
com
.
oo
.
eye
.
db
;
import
android.content.Context
;
import
android.database.sqlite.SQLiteDatabase
;
import
com.oo.eye.gen.DaoMaster
;
import
com.oo.eye.gen.DaoSession
;
/**
/**
*/
*/
public
class
DbManager
{
public
class
DbManager
{
//
private static DbManager mDbManager;
private
static
DbManager
mDbManager
;
//
//
private static final String DB_NAME = "eye_test.db";
private
static
final
String
DB_NAME
=
"eye_test.db"
;
//
private static DaoMaster.DevOpenHelper mDevOpenHelper;
private
static
DaoMaster
.
DevOpenHelper
mDevOpenHelper
;
//
private static DaoMaster mDaoMaster;
private
static
DaoMaster
mDaoMaster
;
//
private static DaoSession mDaoSession;
private
static
DaoSession
mDaoSession
;
//
//
public static DbManager getInstance(Context context) {
public
static
DbManager
getInstance
(
Context
context
)
{
//
if (null == mDbManager) {
if
(
null
==
mDbManager
)
{
//
synchronized (DbManager.class) {
synchronized
(
DbManager
.
class
)
{
//
if (null == mDbManager)
if
(
null
==
mDbManager
)
//
mDbManager = new DbManager(context);
mDbManager
=
new
DbManager
(
context
);
//
}
}
//
}
}
//
//
return mDbManager;
return
mDbManager
;
//
}
}
//
//
private DbManager(Context context) {
private
DbManager
(
Context
context
)
{
//
mDevOpenHelper = new DaoMaster.DevOpenHelper(context,DB_NAME);
mDevOpenHelper
=
new
DaoMaster
.
DevOpenHelper
(
context
,
DB_NAME
);
//
getDaoMaster(context);
getDaoMaster
(
context
);
//
getDaoSession(context);
getDaoSession
(
context
);
//
}
}
//
//
/**
/**
//
* @desc 获取可读数据库
* @desc 获取可读数据库
//
* @autor Tiany
* @autor Tiany
//
* @time 2016/8/13
* @time 2016/8/13
//
**/
**/
//
public static SQLiteDatabase getReadableDatabase(Context context) {
public
static
SQLiteDatabase
getReadableDatabase
(
Context
context
)
{
//
if (null == mDevOpenHelper) {
if
(
null
==
mDevOpenHelper
)
{
//
getInstance(context);
getInstance
(
context
);
//
}
}
//
return mDevOpenHelper.getReadableDatabase();
return
mDevOpenHelper
.
getReadableDatabase
();
//
}
}
//
//
/**
/**
//
* @desc 获取可写数据库
* @desc 获取可写数据库
//
* @autor Tiany
* @autor Tiany
//
* @time 2016/8/13
* @time 2016/8/13
//
**/
**/
//
public static SQLiteDatabase getWritableDatabase(Context context) {
public
static
SQLiteDatabase
getWritableDatabase
(
Context
context
)
{
//
if (null == mDevOpenHelper) {
if
(
null
==
mDevOpenHelper
)
{
//
getInstance(context);
getInstance
(
context
);
//
}
}
//
return mDevOpenHelper.getWritableDatabase();
return
mDevOpenHelper
.
getWritableDatabase
();
//
}
}
//
//
//
/**
/**
//
* 获取DaoSession;
* 获取DaoSession;
//
* @param context
* @param context
//
* @return
* @return
//
*/
*/
//
public static DaoSession getDaoSession(Context context) {
public
static
DaoSession
getDaoSession
(
Context
context
)
{
//
//
if (null == mDaoSession) {
if
(
null
==
mDaoSession
)
{
//
synchronized (DbManager.class) {
synchronized
(
DbManager
.
class
)
{
//
if (null == mDaoSession)
if
(
null
==
mDaoSession
)
//
mDaoSession = getDaoMaster(context).newSession();
mDaoSession
=
getDaoMaster
(
context
).
newSession
();
//
}
}
//
}
}
//
return mDaoSession;
return
mDaoSession
;
//
}
}
//
//
/**
/**
//
* 获取DaoMaster;
* 获取DaoMaster;
//
* @param context
* @param context
//
* @return
* @return
//
*/
*/
//
public static DaoMaster getDaoMaster(Context context) {
public
static
DaoMaster
getDaoMaster
(
Context
context
)
{
//
//
if (null == mDaoMaster) {
if
(
null
==
mDaoMaster
)
{
//
synchronized (DbManager.class) {
synchronized
(
DbManager
.
class
)
{
//
if (null == mDaoMaster)
if
(
null
==
mDaoMaster
)
//
mDaoMaster = new DaoMaster(getWritableDatabase(context));
mDaoMaster
=
new
DaoMaster
(
getWritableDatabase
(
context
));
//
}
}
//
}
}
//
return mDaoMaster;
return
mDaoMaster
;
//
}
}
}
}
app/src/main/java/com/oo/eye/gen/ClassBeanDao.java
0 → 100644
View file @
5480d6e2
package
com
.
oo
.
eye
.
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.oo.eye.bean.ClassBean
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "CLASS_BEAN".
*/
public
class
ClassBeanDao
extends
AbstractDao
<
ClassBean
,
Void
>
{
public
static
final
String
TABLENAME
=
"CLASS_BEAN"
;
/**
* Properties of entity ClassBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public
static
class
Properties
{
public
final
static
Property
Id
=
new
Property
(
0
,
String
.
class
,
"id"
,
false
,
"ID"
);
public
final
static
Property
Sid
=
new
Property
(
1
,
String
.
class
,
"sid"
,
false
,
"SID"
);
public
final
static
Property
Grade
=
new
Property
(
2
,
String
.
class
,
"grade"
,
false
,
"GRADE"
);
public
final
static
Property
Classes
=
new
Property
(
3
,
String
.
class
,
"classes"
,
false
,
"CLASSES"
);
public
final
static
Property
Status
=
new
Property
(
4
,
String
.
class
,
"status"
,
false
,
"STATUS"
);
public
final
static
Property
Orderlist
=
new
Property
(
5
,
String
.
class
,
"orderlist"
,
false
,
"ORDERLIST"
);
public
final
static
Property
Password
=
new
Property
(
6
,
String
.
class
,
"password"
,
false
,
"PASSWORD"
);
}
public
ClassBeanDao
(
DaoConfig
config
)
{
super
(
config
);
}
public
ClassBeanDao
(
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
+
"\"CLASS_BEAN\" ("
+
//
"\"ID\" TEXT,"
+
// 0: id
"\"SID\" TEXT,"
+
// 1: sid
"\"GRADE\" TEXT,"
+
// 2: grade
"\"CLASSES\" TEXT,"
+
// 3: classes
"\"STATUS\" TEXT,"
+
// 4: status
"\"ORDERLIST\" TEXT,"
+
// 5: orderlist
"\"PASSWORD\" TEXT);"
);
// 6: password
}
/** Drops the underlying database table. */
public
static
void
dropTable
(
Database
db
,
boolean
ifExists
)
{
String
sql
=
"DROP TABLE "
+
(
ifExists
?
"IF EXISTS "
:
""
)
+
"\"CLASS_BEAN\""
;
db
.
execSQL
(
sql
);
}
@Override
protected
final
void
bindValues
(
DatabaseStatement
stmt
,
ClassBean
entity
)
{
stmt
.
clearBindings
();
String
id
=
entity
.
getId
();
if
(
id
!=
null
)
{
stmt
.
bindString
(
1
,
id
);
}
String
sid
=
entity
.
getSid
();
if
(
sid
!=
null
)
{
stmt
.
bindString
(
2
,
sid
);
}
String
grade
=
entity
.
getGrade
();
if
(
grade
!=
null
)
{
stmt
.
bindString
(
3
,
grade
);
}
String
classes
=
entity
.
getClasses
();
if
(
classes
!=
null
)
{
stmt
.
bindString
(
4
,
classes
);
}
String
status
=
entity
.
getStatus
();
if
(
status
!=
null
)
{
stmt
.
bindString
(
5
,
status
);
}
String
orderlist
=
entity
.
getOrderlist
();
if
(
orderlist
!=
null
)
{
stmt
.
bindString
(
6
,
orderlist
);
}
String
password
=
entity
.
getPassword
();
if
(
password
!=
null
)
{
stmt
.
bindString
(
7
,
password
);
}
}
@Override
protected
final
void
bindValues
(
SQLiteStatement
stmt
,
ClassBean
entity
)
{
stmt
.
clearBindings
();
String
id
=
entity
.
getId
();
if
(
id
!=
null
)
{
stmt
.
bindString
(
1
,
id
);
}
String
sid
=
entity
.
getSid
();
if
(
sid
!=
null
)
{
stmt
.
bindString
(
2
,
sid
);
}
String
grade
=
entity
.
getGrade
();
if
(
grade
!=
null
)
{
stmt
.
bindString
(
3
,
grade
);
}
String
classes
=
entity
.
getClasses
();
if
(
classes
!=
null
)
{
stmt
.
bindString
(
4
,
classes
);
}
String
status
=
entity
.
getStatus
();
if
(
status
!=
null
)
{
stmt
.
bindString
(
5
,
status
);
}
String
orderlist
=
entity
.
getOrderlist
();
if
(
orderlist
!=
null
)
{
stmt
.
bindString
(
6
,
orderlist
);
}
String
password
=
entity
.
getPassword
();
if
(
password
!=
null
)
{
stmt
.
bindString
(
7
,
password
);
}
}
@Override
public
Void
readKey
(
Cursor
cursor
,
int
offset
)
{
return
null
;
}
@Override
public
ClassBean
readEntity
(
Cursor
cursor
,
int
offset
)
{
ClassBean
entity
=
new
ClassBean
(
//
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getString
(
offset
+
0
),
// id
cursor
.
isNull
(
offset
+
1
)
?
null
:
cursor
.
getString
(
offset
+
1
),
// sid
cursor
.
isNull
(
offset
+
2
)
?
null
:
cursor
.
getString
(
offset
+
2
),
// grade
cursor
.
isNull
(
offset
+
3
)
?
null
:
cursor
.
getString
(
offset
+
3
),
// classes
cursor
.
isNull
(
offset
+
4
)
?
null
:
cursor
.
getString
(
offset
+
4
),
// status
cursor
.
isNull
(
offset
+
5
)
?
null
:
cursor
.
getString
(
offset
+
5
),
// orderlist
cursor
.
isNull
(
offset
+
6
)
?
null
:
cursor
.
getString
(
offset
+
6
)
// password
);
return
entity
;
}
@Override
public
void
readEntity
(
Cursor
cursor
,
ClassBean
entity
,
int
offset
)
{
entity
.
setId
(
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getString
(
offset
+
0
));
entity
.
setSid
(
cursor
.
isNull
(
offset
+
1
)
?
null
:
cursor
.
getString
(
offset
+
1
));
entity
.
setGrade
(
cursor
.
isNull
(
offset
+
2
)
?
null
:
cursor
.
getString
(
offset
+
2
));
entity
.
setClasses
(
cursor
.
isNull
(
offset
+
3
)
?
null
:
cursor
.
getString
(
offset
+
3
));
entity
.
setStatus
(
cursor
.
isNull
(
offset
+
4
)
?
null
:
cursor
.
getString
(
offset
+
4
));
entity
.
setOrderlist
(
cursor
.
isNull
(
offset
+
5
)
?
null
:
cursor
.
getString
(
offset
+
5
));
entity
.
setPassword
(
cursor
.
isNull
(
offset
+
6
)
?
null
:
cursor
.
getString
(
offset
+
6
));
}
@Override
protected
final
Void
updateKeyAfterInsert
(
ClassBean
entity
,
long
rowId
)
{
// Unsupported or missing PK type
return
null
;
}
@Override
public
Void
getKey
(
ClassBean
entity
)
{
return
null
;
}
@Override
public
boolean
hasKey
(
ClassBean
entity
)
{
// TODO
return
false
;
}
@Override
protected
final
boolean
isEntityUpdateable
()
{
return
true
;
}
}
app/src/main/java/com/oo/eye/gen/DaoMaster.java
0 → 100644
View file @
5480d6e2
package
com
.
oo
.
eye
.
gen
;
import
android.content.Context
;
import
android.database.sqlite.SQLiteDatabase
;
import
android.database.sqlite.SQLiteDatabase.CursorFactory
;
import
android.util.Log
;
import
org.greenrobot.greendao.AbstractDaoMaster
;
import
org.greenrobot.greendao.database.StandardDatabase
;
import
org.greenrobot.greendao.database.Database
;
import
org.greenrobot.greendao.database.DatabaseOpenHelper
;
import
org.greenrobot.greendao.identityscope.IdentityScopeType
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 1): knows all DAOs.
*/
public
class
DaoMaster
extends
AbstractDaoMaster
{
public
static
final
int
SCHEMA_VERSION
=
1
;
/** Creates underlying database table using DAOs. */
public
static
void
createAllTables
(
Database
db
,
boolean
ifNotExists
)
{
ClassBeanDao
.
createTable
(
db
,
ifNotExists
);
StudentBeanDao
.
createTable
(
db
,
ifNotExists
);
}
/** Drops underlying database table using DAOs. */
public
static
void
dropAllTables
(
Database
db
,
boolean
ifExists
)
{
ClassBeanDao
.
dropTable
(
db
,
ifExists
);
StudentBeanDao
.
dropTable
(
db
,
ifExists
);
}
/**
* WARNING: Drops all table on Upgrade! Use only during development.
* Convenience method using a {@link DevOpenHelper}.
*/
public
static
DaoSession
newDevSession
(
Context
context
,
String
name
)
{
Database
db
=
new
DevOpenHelper
(
context
,
name
).
getWritableDb
();
DaoMaster
daoMaster
=
new
DaoMaster
(
db
);
return
daoMaster
.
newSession
();
}
public
DaoMaster
(
SQLiteDatabase
db
)
{
this
(
new
StandardDatabase
(
db
));
}
public
DaoMaster
(
Database
db
)
{
super
(
db
,
SCHEMA_VERSION
);
registerDaoClass
(
ClassBeanDao
.
class
);
registerDaoClass
(
StudentBeanDao
.
class
);
}
public
DaoSession
newSession
()
{
return
new
DaoSession
(
db
,
IdentityScopeType
.
Session
,
daoConfigMap
);
}
public
DaoSession
newSession
(
IdentityScopeType
type
)
{
return
new
DaoSession
(
db
,
type
,
daoConfigMap
);
}
/**
* Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -
*/
public
static
abstract
class
OpenHelper
extends
DatabaseOpenHelper
{
public
OpenHelper
(
Context
context
,
String
name
)
{
super
(
context
,
name
,
SCHEMA_VERSION
);
}
public
OpenHelper
(
Context
context
,
String
name
,
CursorFactory
factory
)
{
super
(
context
,
name
,
factory
,
SCHEMA_VERSION
);
}
@Override
public
void
onCreate
(
Database
db
)
{
Log
.
i
(
"greenDAO"
,
"Creating tables for schema version "
+
SCHEMA_VERSION
);
createAllTables
(
db
,
false
);
}
}
/** WARNING: Drops all table on Upgrade! Use only during development. */
public
static
class
DevOpenHelper
extends
OpenHelper
{
public
DevOpenHelper
(
Context
context
,
String
name
)
{
super
(
context
,
name
);
}
public
DevOpenHelper
(
Context
context
,
String
name
,
CursorFactory
factory
)
{
super
(
context
,
name
,
factory
);
}
@Override
public
void
onUpgrade
(
Database
db
,
int
oldVersion
,
int
newVersion
)
{
Log
.
i
(
"greenDAO"
,
"Upgrading schema from version "
+
oldVersion
+
" to "
+
newVersion
+
" by dropping all tables"
);
dropAllTables
(
db
,
true
);
onCreate
(
db
);
}
}
}
app/src/main/java/com/oo/eye/gen/DaoSession.java
0 → 100644
View file @
5480d6e2
package
com
.
oo
.
eye
.
gen
;
import
java.util.Map
;
import
org.greenrobot.greendao.AbstractDao
;
import
org.greenrobot.greendao.AbstractDaoSession
;
import
org.greenrobot.greendao.database.Database
;
import
org.greenrobot.greendao.identityscope.IdentityScopeType
;
import
org.greenrobot.greendao.internal.DaoConfig
;
import
com.oo.eye.bean.ClassBean
;
import
com.oo.eye.bean.StudentBean
;
import
com.oo.eye.gen.ClassBeanDao
;
import
com.oo.eye.gen.StudentBeanDao
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* {@inheritDoc}
*
* @see org.greenrobot.greendao.AbstractDaoSession
*/
public
class
DaoSession
extends
AbstractDaoSession
{
private
final
DaoConfig
classBeanDaoConfig
;
private
final
DaoConfig
studentBeanDaoConfig
;
private
final
ClassBeanDao
classBeanDao
;
private
final
StudentBeanDao
studentBeanDao
;
public
DaoSession
(
Database
db
,
IdentityScopeType
type
,
Map
<
Class
<?
extends
AbstractDao
<?,
?>>,
DaoConfig
>
daoConfigMap
)
{
super
(
db
);
classBeanDaoConfig
=
daoConfigMap
.
get
(
ClassBeanDao
.
class
).
clone
();
classBeanDaoConfig
.
initIdentityScope
(
type
);
studentBeanDaoConfig
=
daoConfigMap
.
get
(
StudentBeanDao
.
class
).
clone
();
studentBeanDaoConfig
.
initIdentityScope
(
type
);
classBeanDao
=
new
ClassBeanDao
(
classBeanDaoConfig
,
this
);
studentBeanDao
=
new
StudentBeanDao
(
studentBeanDaoConfig
,
this
);
registerDao
(
ClassBean
.
class
,
classBeanDao
);
registerDao
(
StudentBean
.
class
,
studentBeanDao
);
}
public
void
clear
()
{
classBeanDaoConfig
.
clearIdentityScope
();
studentBeanDaoConfig
.
clearIdentityScope
();
}
public
ClassBeanDao
getClassBeanDao
()
{
return
classBeanDao
;
}
public
StudentBeanDao
getStudentBeanDao
()
{
return
studentBeanDao
;
}
}
app/src/main/java/com/oo/eye/gen/StudentBeanDao.java
0 → 100644
View file @
5480d6e2
package
com
.
oo
.
eye
.
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.oo.eye.bean.StudentBean
;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "STUDENT_BEAN".
*/
public
class
StudentBeanDao
extends
AbstractDao
<
StudentBean
,
Void
>
{
public
static
final
String
TABLENAME
=
"STUDENT_BEAN"
;
/**
* Properties of entity StudentBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public
static
class
Properties
{
public
final
static
Property
Sid
=
new
Property
(
0
,
String
.
class
,
"sid"
,
false
,
"SID"
);
public
final
static
Property
Uid
=
new
Property
(
1
,
String
.
class
,
"uid"
,
false
,
"UID"
);
public
final
static
Property
School
=
new
Property
(
2
,
String
.
class
,
"school"
,
false
,
"SCHOOL"
);
public
final
static
Property
Grade
=
new
Property
(
3
,
String
.
class
,
"grade"
,
false
,
"GRADE"
);
public
final
static
Property
Classes
=
new
Property
(
4
,
String
.
class
,
"classes"
,
false
,
"CLASSES"
);
public
final
static
Property
Status
=
new
Property
(
5
,
String
.
class
,
"status"
,
false
,
"STATUS"
);
public
final
static
Property
Realname
=
new
Property
(
6
,
String
.
class
,
"realname"
,
false
,
"REALNAME"
);
public
final
static
Property
Number
=
new
Property
(
7
,
String
.
class
,
"number"
,
false
,
"NUMBER"
);
public
final
static
Property
Left_eye
=
new
Property
(
8
,
double
.
class
,
"left_eye"
,
false
,
"LEFT_EYE"
);
public
final
static
Property
Right_eye
=
new
Property
(
9
,
double
.
class
,
"right_eye"
,
false
,
"RIGHT_EYE"
);
public
final
static
Property
Url
=
new
Property
(
10
,
String
.
class
,
"url"
,
false
,
"URL"
);
public
final
static
Property
Pid
=
new
Property
(
11
,
String
.
class
,
"pid"
,
false
,
"PID"
);
public
final
static
Property
Distance
=
new
Property
(
12
,
int
.
class
,
"distance"
,
false
,
"DISTANCE"
);
public
final
static
Property
IsChick
=
new
Property
(
13
,
boolean
.
class
,
"isChick"
,
false
,
"IS_CHICK"
);
public
final
static
Property
Birthday
=
new
Property
(
14
,
String
.
class
,
"birthday"
,
false
,
"BIRTHDAY"
);
}
public
StudentBeanDao
(
DaoConfig
config
)
{
super
(
config
);
}
public
StudentBeanDao
(
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
+
"\"STUDENT_BEAN\" ("
+
//
"\"SID\" TEXT,"
+
// 0: sid
"\"UID\" TEXT,"
+
// 1: uid
"\"SCHOOL\" TEXT,"
+
// 2: school
"\"GRADE\" TEXT,"
+
// 3: grade
"\"CLASSES\" TEXT,"
+
// 4: classes
"\"STATUS\" TEXT,"
+
// 5: status
"\"REALNAME\" TEXT,"
+
// 6: realname
"\"NUMBER\" TEXT,"
+
// 7: number
"\"LEFT_EYE\" REAL NOT NULL ,"
+
// 8: left_eye
"\"RIGHT_EYE\" REAL NOT NULL ,"
+
// 9: right_eye
"\"URL\" TEXT,"
+
// 10: url
"\"PID\" TEXT,"
+
// 11: pid
"\"DISTANCE\" INTEGER NOT NULL ,"
+
// 12: distance
"\"IS_CHICK\" INTEGER NOT NULL ,"
+
// 13: isChick
"\"BIRTHDAY\" TEXT);"
);
// 14: birthday
}
/** Drops the underlying database table. */
public
static
void
dropTable
(
Database
db
,
boolean
ifExists
)
{
String
sql
=
"DROP TABLE "
+
(
ifExists
?
"IF EXISTS "
:
""
)
+
"\"STUDENT_BEAN\""
;
db
.
execSQL
(
sql
);
}
@Override
protected
final
void
bindValues
(
DatabaseStatement
stmt
,
StudentBean
entity
)
{
stmt
.
clearBindings
();
String
sid
=
entity
.
getSid
();
if
(
sid
!=
null
)
{
stmt
.
bindString
(
1
,
sid
);
}
String
uid
=
entity
.
getUid
();
if
(
uid
!=
null
)
{
stmt
.
bindString
(
2
,
uid
);
}
String
school
=
entity
.
getSchool
();
if
(
school
!=
null
)
{
stmt
.
bindString
(
3
,
school
);
}
String
grade
=
entity
.
getGrade
();
if
(
grade
!=
null
)
{
stmt
.
bindString
(
4
,
grade
);
}
String
classes
=
entity
.
getClasses
();
if
(
classes
!=
null
)
{
stmt
.
bindString
(
5
,
classes
);
}
String
status
=
entity
.
getStatus
();
if
(
status
!=
null
)
{
stmt
.
bindString
(
6
,
status
);
}
String
realname
=
entity
.
getRealname
();
if
(
realname
!=
null
)
{
stmt
.
bindString
(
7
,
realname
);
}
String
number
=
entity
.
getNumber
();
if
(
number
!=
null
)
{
stmt
.
bindString
(
8
,
number
);
}
stmt
.
bindDouble
(
9
,
entity
.
getLeft_eye
());
stmt
.
bindDouble
(
10
,
entity
.
getRight_eye
());
String
url
=
entity
.
getUrl
();
if
(
url
!=
null
)
{
stmt
.
bindString
(
11
,
url
);
}
String
pid
=
entity
.
getPid
();
if
(
pid
!=
null
)
{
stmt
.
bindString
(
12
,
pid
);
}
stmt
.
bindLong
(
13
,
entity
.
getDistance
());
stmt
.
bindLong
(
14
,
entity
.
getIsChick
()
?
1L
:
0L
);
String
birthday
=
entity
.
getBirthday
();
if
(
birthday
!=
null
)
{
stmt
.
bindString
(
15
,
birthday
);
}
}
@Override
protected
final
void
bindValues
(
SQLiteStatement
stmt
,
StudentBean
entity
)
{
stmt
.
clearBindings
();
String
sid
=
entity
.
getSid
();
if
(
sid
!=
null
)
{
stmt
.
bindString
(
1
,
sid
);
}
String
uid
=
entity
.
getUid
();
if
(
uid
!=
null
)
{
stmt
.
bindString
(
2
,
uid
);
}
String
school
=
entity
.
getSchool
();
if
(
school
!=
null
)
{
stmt
.
bindString
(
3
,
school
);
}
String
grade
=
entity
.
getGrade
();
if
(
grade
!=
null
)
{
stmt
.
bindString
(
4
,
grade
);
}
String
classes
=
entity
.
getClasses
();
if
(
classes
!=
null
)
{
stmt
.
bindString
(
5
,
classes
);
}
String
status
=
entity
.
getStatus
();
if
(
status
!=
null
)
{
stmt
.
bindString
(
6
,
status
);
}
String
realname
=
entity
.
getRealname
();
if
(
realname
!=
null
)
{
stmt
.
bindString
(
7
,
realname
);
}
String
number
=
entity
.
getNumber
();
if
(
number
!=
null
)
{
stmt
.
bindString
(
8
,
number
);
}
stmt
.
bindDouble
(
9
,
entity
.
getLeft_eye
());
stmt
.
bindDouble
(
10
,
entity
.
getRight_eye
());
String
url
=
entity
.
getUrl
();
if
(
url
!=
null
)
{
stmt
.
bindString
(
11
,
url
);
}
String
pid
=
entity
.
getPid
();
if
(
pid
!=
null
)
{
stmt
.
bindString
(
12
,
pid
);
}
stmt
.
bindLong
(
13
,
entity
.
getDistance
());
stmt
.
bindLong
(
14
,
entity
.
getIsChick
()
?
1L
:
0L
);
String
birthday
=
entity
.
getBirthday
();
if
(
birthday
!=
null
)
{
stmt
.
bindString
(
15
,
birthday
);
}
}
@Override
public
Void
readKey
(
Cursor
cursor
,
int
offset
)
{
return
null
;
}
@Override
public
StudentBean
readEntity
(
Cursor
cursor
,
int
offset
)
{
StudentBean
entity
=
new
StudentBean
(
//
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getString
(
offset
+
0
),
// sid
cursor
.
isNull
(
offset
+
1
)
?
null
:
cursor
.
getString
(
offset
+
1
),
// uid
cursor
.
isNull
(
offset
+
2
)
?
null
:
cursor
.
getString
(
offset
+
2
),
// school
cursor
.
isNull
(
offset
+
3
)
?
null
:
cursor
.
getString
(
offset
+
3
),
// grade
cursor
.
isNull
(
offset
+
4
)
?
null
:
cursor
.
getString
(
offset
+
4
),
// classes
cursor
.
isNull
(
offset
+
5
)
?
null
:
cursor
.
getString
(
offset
+
5
),
// status
cursor
.
isNull
(
offset
+
6
)
?
null
:
cursor
.
getString
(
offset
+
6
),
// realname
cursor
.
isNull
(
offset
+
7
)
?
null
:
cursor
.
getString
(
offset
+
7
),
// number
cursor
.
getDouble
(
offset
+
8
),
// left_eye
cursor
.
getDouble
(
offset
+
9
),
// right_eye
cursor
.
isNull
(
offset
+
10
)
?
null
:
cursor
.
getString
(
offset
+
10
),
// url
cursor
.
isNull
(
offset
+
11
)
?
null
:
cursor
.
getString
(
offset
+
11
),
// pid
cursor
.
getInt
(
offset
+
12
),
// distance
cursor
.
getShort
(
offset
+
13
)
!=
0
,
// isChick
cursor
.
isNull
(
offset
+
14
)
?
null
:
cursor
.
getString
(
offset
+
14
)
// birthday
);
return
entity
;
}
@Override
public
void
readEntity
(
Cursor
cursor
,
StudentBean
entity
,
int
offset
)
{
entity
.
setSid
(
cursor
.
isNull
(
offset
+
0
)
?
null
:
cursor
.
getString
(
offset
+
0
));
entity
.
setUid
(
cursor
.
isNull
(
offset
+
1
)
?
null
:
cursor
.
getString
(
offset
+
1
));
entity
.
setSchool
(
cursor
.
isNull
(
offset
+
2
)
?
null
:
cursor
.
getString
(
offset
+
2
));
entity
.
setGrade
(
cursor
.
isNull
(
offset
+
3
)
?
null
:
cursor
.
getString
(
offset
+
3
));
entity
.
setClasses
(
cursor
.
isNull
(
offset
+
4
)
?
null
:
cursor
.
getString
(
offset
+
4
));
entity
.
setStatus
(
cursor
.
isNull
(
offset
+
5
)
?
null
:
cursor
.
getString
(
offset
+
5
));
entity
.
setRealname
(
cursor
.
isNull
(
offset
+
6
)
?
null
:
cursor
.
getString
(
offset
+
6
));
entity
.
setNumber
(
cursor
.
isNull
(
offset
+
7
)
?
null
:
cursor
.
getString
(
offset
+
7
));
entity
.
setLeft_eye
(
cursor
.
getDouble
(
offset
+
8
));
entity
.
setRight_eye
(
cursor
.
getDouble
(
offset
+
9
));
entity
.
setUrl
(
cursor
.
isNull
(
offset
+
10
)
?
null
:
cursor
.
getString
(
offset
+
10
));
entity
.
setPid
(
cursor
.
isNull
(
offset
+
11
)
?
null
:
cursor
.
getString
(
offset
+
11
));
entity
.
setDistance
(
cursor
.
getInt
(
offset
+
12
));
entity
.
setIsChick
(
cursor
.
getShort
(
offset
+
13
)
!=
0
);
entity
.
setBirthday
(
cursor
.
isNull
(
offset
+
14
)
?
null
:
cursor
.
getString
(
offset
+
14
));
}
@Override
protected
final
Void
updateKeyAfterInsert
(
StudentBean
entity
,
long
rowId
)
{
// Unsupported or missing PK type
return
null
;
}
@Override
public
Void
getKey
(
StudentBean
entity
)
{
return
null
;
}
@Override
public
boolean
hasKey
(
StudentBean
entity
)
{
// TODO
return
false
;
}
@Override
protected
final
boolean
isEntityUpdateable
()
{
return
true
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment