| | |
| | | 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);
|
| | |
| | | }
|
| | | Integer total = null;
|
| | | while (c_count.moveToNext()) {
|
| | | total = c.getInt(c.getColumnIndex("count"));
|
| | | total = c_count.getInt(0);
|
| | | }
|
| | | resultBean.setTotalPages(getTotalPageSize(total));
|
| | | resultBean.setPageNum(pageNum);
|
| | |
| | | if(deviceCompanyId != null && !deviceCompanyId.trim().isEmpty()) {
|
| | | sb.append(" AND a.device_company_id = ").append(deviceCompanyId);
|
| | | }
|
| | | sb.append("ORDER BY a.time DESC");
|
| | | 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);
|
| | |
| | | }
|
| | | Integer total = null;
|
| | | while (c_count.moveToNext()) {
|
| | | total = c.getInt(c.getColumnIndex("count"));
|
| | | total = c_count.getInt(0);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | |
|
| | | }
|