|
|
@@ -72,22 +72,25 @@ public class ContactsDao {
|
|
|
String ownerId=MyApplication.getInstance().mLoginUser.getUserId();
|
|
|
LogUtil.d("Test","master:"+master+" ownerId:"+ownerId);
|
|
|
List<ContactsModel> models=new ArrayList<>();
|
|
|
- Cursor cursor =db.rawQuery("select * from tbl_contacts a where id=" +
|
|
|
- "(select min(id) from tbl_contacts where tf_phone=a.tf_phone and tf_ownerId=? ) and (tf_phone<> ? and tf_phone<> ?) " +
|
|
|
- " ", new String[]{ownerId,"未填写"," "});
|
|
|
+// Cursor cursor =db.rawQuery("select * from tbl_contacts a where id=" +
|
|
|
+// "(select min(id) from tbl_contacts where tf_phone=a.tf_phone and tf_ownerId=? ) and (tf_phone<> ? and tf_phone<> ?) " +
|
|
|
+// " ", new String[]{ownerId,"未填写"," "});
|
|
|
+
|
|
|
+ String sql="select * from tbl_contacts where tf_phone in (select tf_phone from (select tf_phone,max(id) from tbl_contacts where (tf_phone<> ? and tf_phone<> ?) group by tf_phone)) and tf_ownerId=?";
|
|
|
// Cursor cursor =db.rawQuery("select * from tbl_contacts a where id=" +
|
|
|
// "(select min(id) from tbl_contacts where tf_phone=a.tf_phone and tf_ownerId=? ) and (tf_phone<> ? and tf_phone<> ?) " +
|
|
|
// " and (tf_whichSys=? or tf_whichSys=? ) ", new String[]{ownerId,"未填写"," ",master,""});
|
|
|
+ Cursor cursor =db.rawQuery(sql,new String[]{"未填写"," ",ownerId});
|
|
|
while (cursor.moveToNext()) {
|
|
|
ContactsModel model=new ContactsModel();
|
|
|
model.setName(cursor.getString(cursor.getColumnIndex("tf_name")));
|
|
|
- model.setCompany(cursor.getString(cursor.getColumnIndex("tf_company")));
|
|
|
model.setWhichsys(cursor.getString(cursor.getColumnIndex("tf_whichSys")));
|
|
|
+ model.setCompany(cursor.getString(cursor.getColumnIndex("tf_company")));
|
|
|
model.setPhone(cursor.getString(cursor.getColumnIndex("tf_phone")));
|
|
|
model.setEmail(cursor.getString(cursor.getColumnIndex("tf_email")));
|
|
|
model.setType(cursor.getInt(cursor.getColumnIndex("tf_type")));
|
|
|
- model.setImid(cursor.getString(cursor.getColumnIndex("tf_imId")));
|
|
|
model.setOwnerId(cursor.getString(cursor.getColumnIndex("tf_ownerId")));
|
|
|
+ model.setImid(cursor.getString(cursor.getColumnIndex("tf_imId")));
|
|
|
models.add(model);
|
|
|
}
|
|
|
cursor.close();
|