|
@ -32,6 +32,7 @@ import com.ekexiu.portal.po.Organization;
|
32
|
32
|
import com.ekexiu.portal.po.Professor;
|
33
|
33
|
import com.ekexiu.portal.pojo.EditProfessor;
|
34
|
34
|
import com.ekexiu.portal.pojo.ProfessorInfo;
|
|
35
|
import com.ekexiu.portal.pojo.UserInfo;
|
35
|
36
|
|
36
|
37
|
@DAO
|
37
|
38
|
public abstract class ProfessorDao {
|
|
@ -1308,5 +1309,204 @@ public abstract class ProfessorDao {
|
1308
|
1309
|
}
|
1309
|
1310
|
}
|
1310
|
1311
|
}
|
|
1312
|
|
|
1313
|
public PageQueryResult<UserInfo> queryUserInfo(Connection con,String key,String address,Integer authType,String orgName,Integer activeState,int pageSize,int pageNo) throws SQLException{
|
|
1314
|
PageQueryResult<UserInfo> _result = new PageQueryResult<UserInfo>();
|
|
1315
|
StringBuilder sql = new StringBuilder();
|
|
1316
|
boolean hasKey = null != key;
|
|
1317
|
if (hasKey) {
|
|
1318
|
sql.append(" WHERE ( (O.NAME LIKE ?) OR (P.NAME LIKE ?) OR (P.OFFICE LIKE ?) OR (P.TITLE LIKE ?) "
|
|
1319
|
+ " OR (P.DEPARTMENT LIKE ?) OR (P.PHONE LIKE ?) OR (P.EMAIL LIKE ?) OR (P.ADDRESS LIKE ?) )");
|
|
1320
|
}
|
|
1321
|
boolean hasAddress = null != address;
|
|
1322
|
boolean hasAuthType = null != authType;
|
|
1323
|
boolean hasOrgName = null != orgName;
|
|
1324
|
boolean hasActiveState = null != activeState;
|
|
1325
|
if (hasAddress) {
|
|
1326
|
sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.ADDRESS LIKE ?)");
|
|
1327
|
}
|
|
1328
|
if (hasAuthType) {
|
|
1329
|
sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(AUTH_TYPE = ?)");
|
|
1330
|
}
|
|
1331
|
if (hasOrgName) {
|
|
1332
|
sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(O.NAME LIKE ?)");
|
|
1333
|
}
|
|
1334
|
if (hasActiveState) {
|
|
1335
|
sql.append(sql.length() > 0 ? " AND " : " WHERE ");
|
|
1336
|
if (activeState == 1) {
|
|
1337
|
sql.append("(L.ACTIVE_TIME IS NOT NULL)");
|
|
1338
|
} else {
|
|
1339
|
sql.append("(L.ACTIVE_TIME IS NULL)");
|
|
1340
|
}
|
|
1341
|
}
|
1311
|
1342
|
|
|
1343
|
StringBuilder whereSql = sql;
|
|
1344
|
sql = new StringBuilder();
|
|
1345
|
sql.append("SELECT COUNT(1) FROM PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID LEFT JOIN LUSER L ON P.ID=L.ID ");
|
|
1346
|
if (whereSql.length() > 0) {
|
|
1347
|
sql.append(whereSql);
|
|
1348
|
}
|
|
1349
|
PreparedStatement ps = con.prepareStatement(sql.toString());
|
|
1350
|
int paramIndex = 1;
|
|
1351
|
int totalSize = 0;
|
|
1352
|
try {
|
|
1353
|
if (hasKey) {
|
|
1354
|
ps.setString(paramIndex++, key);
|
|
1355
|
ps.setString(paramIndex++, key);
|
|
1356
|
ps.setString(paramIndex++, key);
|
|
1357
|
ps.setString(paramIndex++, key);
|
|
1358
|
ps.setString(paramIndex++, key);
|
|
1359
|
ps.setString(paramIndex++, key);
|
|
1360
|
ps.setString(paramIndex++, key);
|
|
1361
|
ps.setString(paramIndex++, key);
|
|
1362
|
}
|
|
1363
|
if (hasAddress) {
|
|
1364
|
ps.setString(paramIndex++, address);
|
|
1365
|
}
|
|
1366
|
if (hasAuthType) {
|
|
1367
|
ps.setInt(paramIndex++, authType);
|
|
1368
|
}
|
|
1369
|
if (hasOrgName) {
|
|
1370
|
ps.setString(paramIndex++, orgName);
|
|
1371
|
}
|
|
1372
|
_result.setPageSize(pageSize);
|
|
1373
|
ResultSet _pageRs = ps.executeQuery();
|
|
1374
|
try {
|
|
1375
|
_pageRs.next();
|
|
1376
|
totalSize = _pageRs.getInt(1);
|
|
1377
|
} finally {
|
|
1378
|
try {
|
|
1379
|
_pageRs.close();
|
|
1380
|
} catch (Exception _m_6) {
|
|
1381
|
}
|
|
1382
|
}
|
|
1383
|
} finally {
|
|
1384
|
try {
|
|
1385
|
ps.close();
|
|
1386
|
} catch (Exception _m_7) {
|
|
1387
|
}
|
|
1388
|
}
|
|
1389
|
_result.setTotal(totalSize);
|
|
1390
|
if (0 == totalSize) {
|
|
1391
|
_result.setPageNo(1);
|
|
1392
|
_result.setData(Collections.<UserInfo> emptyList());
|
|
1393
|
return _result;
|
|
1394
|
}
|
|
1395
|
paramIndex = 1;
|
|
1396
|
if (1 == pageNo) {
|
|
1397
|
_result.setPageNo(1);
|
|
1398
|
sql = new StringBuilder();
|
|
1399
|
sql.append("SELECT OFFICE,SUBJECT,INDUSTRY,ADDRESS,DEPARTMENT,O.NAME AS ONAME,TITLE,AUTHENTICATION,"
|
|
1400
|
+ " AUTH_TYPE,AUTH_STATUS,P.ID,P.NAME AS PNAME,P.EMAIL,P.PHONE,L.ACTIVE_TIME "
|
|
1401
|
+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID LEFT JOIN LUSER L ON P.ID=L.ID");
|
|
1402
|
if (whereSql.length() > 0) {
|
|
1403
|
sql.append(whereSql);
|
|
1404
|
}
|
|
1405
|
sql.append(" ORDER BY P.CREATE_TIME DESC,P.ID ");
|
|
1406
|
sql.append(" LIMIT ").append(pageSize);
|
|
1407
|
} else {
|
|
1408
|
int _pageSize = totalSize / pageSize;
|
|
1409
|
if (totalSize % pageSize != 0) {
|
|
1410
|
++_pageSize;
|
|
1411
|
}
|
|
1412
|
if (pageNo > _pageSize) {
|
|
1413
|
pageNo = _pageSize;
|
|
1414
|
}
|
|
1415
|
_result.setPageNo(pageNo);
|
|
1416
|
--pageNo;
|
|
1417
|
int _m_10 = (pageNo * pageSize);
|
|
1418
|
sql = new StringBuilder();
|
|
1419
|
sql.append("SELECT OFFICE,SUBJECT,INDUSTRY,ADDRESS,DEPARTMENT,O.NAME AS ONAME,TITLE,AUTHENTICATION,"
|
|
1420
|
+ " AUTH_TYPE,AUTH_STATUS,P.ID,P.NAME AS PNAME,P.EMAIL,P.PHONE,L.ACTIVE_TIME "
|
|
1421
|
+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID LEFT JOIN LUSER L ON P.ID=L.ID");
|
|
1422
|
if (whereSql.length() > 0) {
|
|
1423
|
sql.append(whereSql);
|
|
1424
|
}
|
|
1425
|
sql.append(" ORDER BY P.CREATE_TIME DESC,P.ID ");
|
|
1426
|
sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
|
|
1427
|
}
|
|
1428
|
ps = con.prepareStatement(sql.toString());
|
|
1429
|
try {
|
|
1430
|
if (hasKey) {
|
|
1431
|
ps.setString(paramIndex++, key);
|
|
1432
|
ps.setString(paramIndex++, key);
|
|
1433
|
ps.setString(paramIndex++, key);
|
|
1434
|
ps.setString(paramIndex++, key);
|
|
1435
|
ps.setString(paramIndex++, key);
|
|
1436
|
ps.setString(paramIndex++, key);
|
|
1437
|
ps.setString(paramIndex++, key);
|
|
1438
|
ps.setString(paramIndex++, key);
|
|
1439
|
}
|
|
1440
|
if (hasAddress) {
|
|
1441
|
ps.setString(paramIndex++, address);
|
|
1442
|
}
|
|
1443
|
if (hasAuthType) {
|
|
1444
|
ps.setInt(paramIndex++, authType);
|
|
1445
|
}
|
|
1446
|
if (hasOrgName) {
|
|
1447
|
ps.setString(paramIndex++, orgName);
|
|
1448
|
}
|
|
1449
|
ResultSet rs = ps.executeQuery();
|
|
1450
|
try {
|
|
1451
|
List<UserInfo> _m_11 = new ArrayList<UserInfo>();
|
|
1452
|
_result.setData(_m_11);
|
|
1453
|
while (rs.next()) {
|
|
1454
|
UserInfo userInfo = new UserInfo();
|
|
1455
|
String office = rs.getString(1);
|
|
1456
|
if(rs.wasNull()){
|
|
1457
|
office = null;
|
|
1458
|
}
|
|
1459
|
userInfo.setOffice(office);
|
|
1460
|
String subj = rs.getString(2);
|
|
1461
|
if(rs.wasNull()){
|
|
1462
|
subj = null;
|
|
1463
|
}
|
|
1464
|
userInfo.setSubject(subj);
|
|
1465
|
String indus = rs.getString(3);
|
|
1466
|
if(rs.wasNull()){
|
|
1467
|
indus = null;
|
|
1468
|
}
|
|
1469
|
userInfo.setIndustry(indus);
|
|
1470
|
String addr = rs.getString(4);
|
|
1471
|
if(rs.wasNull()){
|
|
1472
|
addr = null;
|
|
1473
|
}
|
|
1474
|
userInfo.setAddress(addr);
|
|
1475
|
String depart = rs.getString(5);
|
|
1476
|
if(rs.wasNull()){
|
|
1477
|
depart = null;
|
|
1478
|
}
|
|
1479
|
userInfo.setDepartment(depart);
|
|
1480
|
userInfo.setOrgName(rs.getString(6));
|
|
1481
|
String title = rs.getString(7);
|
|
1482
|
if(rs.wasNull()){
|
|
1483
|
title = null;
|
|
1484
|
}
|
|
1485
|
userInfo.setTitle(title);
|
|
1486
|
userInfo.setAuthentication(rs.getInt(8));
|
|
1487
|
userInfo.setAuthType(rs.getInt(9));
|
|
1488
|
userInfo.setAuthStatus(rs.getInt(10));
|
|
1489
|
userInfo.setId(rs.getString(11));
|
|
1490
|
userInfo.setName(rs.getString(12));
|
|
1491
|
userInfo.setEmail(rs.getString(13));
|
|
1492
|
userInfo.setPhone(rs.getString(14));
|
|
1493
|
userInfo.setActiveTime(rs.getString(15));
|
|
1494
|
userInfo.setActiveState(!(rs.getString(15)==null));
|
|
1495
|
_m_11.add(userInfo);
|
|
1496
|
}
|
|
1497
|
return _result;
|
|
1498
|
} finally {
|
|
1499
|
try {
|
|
1500
|
rs.close();
|
|
1501
|
} catch (Exception _m_17) {
|
|
1502
|
}
|
|
1503
|
}
|
|
1504
|
} finally {
|
|
1505
|
try {
|
|
1506
|
ps.close();
|
|
1507
|
} catch (Exception _m_18) {
|
|
1508
|
}
|
|
1509
|
}
|
|
1510
|
}
|
|
1511
|
|
1312
|
1512
|
}
|