| | |
| | | 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;
|
| | |
| | | ResultBean resultBean = new ResultBean();
|
| | | SQLiteDatabase db = MainActivity.getInstance().db;
|
| | | try {
|
| | | String deviceCompanyId = BaseApplication.getInstance().getAndroidDevice().getCompanyId();
|
| | | StringBuilder sb = new StringBuilder(40);
|
| | | sb.append("SELECT b.register_id,").append(" b.username,").append(" b.surveillance_photo,")
|
| | | .append(" b.identify_num,").append(" e.post_name,").append(" d.`name` gender,")
|
| | | .append(" b.identify_num,").append(" e.post_name,").append(" d.name gender,")
|
| | | .append(" f.dept_name").append(" FROM ").append(" employee a ")
|
| | | .append(" LEFT JOIN register b ON a.register_id = b.register_id ")
|
| | | .append(" LEFT JOIN dictionary d ON d.dict_id = b.gender_id ")
|
| | | .append(" LEFT JOIN post e ON e.post_id = b.post_id ")
|
| | | .append(" LEFT JOIN department f ON f.dept_id = b.department_id ")
|
| | | .append(" WHERE ").append(" 1 = 1 ").append(" GROUP BY b.register_id ")
|
| | | .append(" ORDER BY b.username ");
|
| | | String deviceCompanyId = BaseApplication.getInstance().getAndroidDevice().getCompanyId();
|
| | | .append(" WHERE ").append(" 1 = 1 ");
|
| | | if(deviceCompanyId != null && !deviceCompanyId.trim().isEmpty()) {
|
| | | sb.append(" AND a.device_company_id = ").append(deviceCompanyId);
|
| | | }
|
| | | if(searchText != null && !searchText.trim().isEmpty()) {
|
| | | sb.append(" AND b.username LIKE '%").append(searchText).append("%'");
|
| | | }
|
| | | sb.append(" GROUP BY b.register_id ")
|
| | | .append(" ORDER BY b.username ");
|
| | |
|
| | | StringBuilder count = new StringBuilder(sb.length());
|
| | | count.append("select count(*) as count from (").append(sb).append(" ) _table");
|
| | | sb.append(" LIMIT ").append(getStartIndex(pageNum)).append(",").append(CommonVariables.Page.DEFAULT_PAGE_SIZE);
|
| | |
| | | if(deviceId != null && !deviceId.trim().isEmpty()) {
|
| | | sb.append(" AND b.device_id=").append(deviceId);
|
| | | }
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | sb.append(" AND a.time like '"+sdf.format(new Date())+"%' ");
|
| | | String deviceCompanyId = BaseApplication.getInstance().getAndroidDevice().getCompanyId();
|
| | | if(deviceCompanyId != null && !deviceCompanyId.trim().isEmpty()) {
|
| | | sb.append(" AND a.device_company_id = ").append(deviceCompanyId);
|
| | |
| | | sb.append(" ORDER BY a.time DESC");
|
| | | StringBuilder count = new StringBuilder(sb.length());
|
| | | count.append("select count(*) as count from (").append(sb).append(" ) _table");
|
| | | sb.append(" LIMIT ").append("0").append(",").append(100);
|
| | | AttendanceDetailQueryItem aqi = null;
|
| | | Cursor c = db.rawQuery(sb.toString(),new String[]{});
|
| | | Cursor c_count = db.rawQuery(count.toString(),new String[]{});
|
| | |
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | |
|
| | | }
|