| | |
| | | package cn.com.basic.face.service.sqlite;
|
| | |
|
| | | import android.database.Cursor;
|
| | | import android.database.sqlite.SQLiteDatabase;
|
| | |
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.base.BaseApplication;
|
| | | import cn.com.basic.face.base.Config;
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.discern.common.CommonVariables;
|
| | | import cn.com.basic.face.discern.entity.Dictionary;
|
| | |
|
| | | import static cn.com.basic.face.discern.entity.Register.FieldNames.company;
|
| | |
|
| | | /**
|
| | | * 数据字典Dao
|
| | |
| | | return list;
|
| | | }
|
| | |
|
| | | }
|
| | | //加载需要同步的数据
|
| | | public List<Dictionary> getDictionayList(String deviceCompanyId){
|
| | | String sql="select * from dictionary WHERE is_synchron='N' and device_company_id="+Integer.parseInt(deviceCompanyId);
|
| | | Cursor c =MainActivity.getInstance().db.rawQuery(sql,new String[]{});
|
| | | List<Dictionary> result=new ArrayList<Dictionary>();
|
| | | Dictionary dic=null;
|
| | | if(c.moveToFirst()){
|
| | | dic=new Dictionary();
|
| | | dic.setSn(c.getString(c.getColumnIndex("sn")));
|
| | | dic.setType(c.getString(c.getColumnIndex("type")));
|
| | | dic.setCompnayId(c.getString(c.getColumnIndex("compnay_id")));
|
| | | dic.setDeviceCompanyId(c.getString(c.getColumnIndex("device_company_id")));
|
| | | dic.setDictId(c.getString(c.getColumnIndex("dict_id")));
|
| | | dic.setIsSynchron(c.getString(c.getColumnIndex("is_synchron")));
|
| | | dic.setUpdateTime(c.getString(c.getColumnIndex("update_time")));
|
| | | dic.setName(c.getString(c.getColumnIndex("name")));
|
| | | dic.setOrderBy(c.getString(c.getColumnIndex("order_by")));
|
| | | dic.setPid(c.getString(c.getColumnIndex("pid")));
|
| | | dic.setRemark(c.getString(c.getColumnIndex("remark")));
|
| | | dic.setIsValid(c.getString(c.getColumnIndex("is_valid")));
|
| | | dic.setCreateTime(c.getString(c.getColumnIndex("create_time")));
|
| | | result.add(dic);
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | //删除已经上传到服务器的数据
|
| | | public void delDictionary(){
|
| | | String sql="delete from dictionary where is_synchron='N'";
|
| | | MainActivity.getInstance().db.execSQL(sql);
|
| | |
|
| | | }
|
| | | //获取未同步数据总数
|
| | | public int getSynDataCount(){
|
| | | String sql="select count(*) from dictionary where is_synchron='N' ";
|
| | | Cursor c =MainActivity.getInstance().db.rawQuery(sql,new String[]{});
|
| | | c.moveToFirst();
|
| | | return c.getInt(0);
|
| | | }
|
| | |
|
| | | }
|
| | |
|