Select1.jsp
28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
<!DOCTYPE HTML>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.file.Prop,
weaver.general.GCONST" %>
<!-- added by wcd 2014-07-08 -->
<%@ page import="weaver.conn.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="org.apache.commons.lang.StringUtils,weaver.hrm.appdetach.*"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page" />
<jsp:useBean id="RoleComInfo" class="weaver.hrm.roles.RolesComInfo" scope="page" />
<jsp:useBean id="JobTitlesComInfo" class="weaver.hrm.job.JobTitlesComInfo" scope="page" />
<jsp:useBean id="adci" class="weaver.hrm.appdetach.AppDetachComInfo" scope="page" />
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<!-- added by wcd 2014-07-08 start -->
<%!
/**
* 取得指定分部下所有分部id(包括指定分部id)
* @param subId
* @return
*/
public String getAllSubId(String subId,String ids){
RecordSet rs_s = new RecordSet();
rs_s.executeSql("select id from HrmSubCompany where id <> " + subId + " and supsubcomid = "+subId);
while(rs_s.next()){
ids += ","+rs_s.getString(1);
ids = this.getAllSubId(rs_s.getString(1), ids);
}
return ids;
}
/**
* 取得指定部门下所有部门id(包括指定部门id)
* @param deptId
* @param ids
* @return
*/
public String getAllDeptId(String deptId,String ids){
RecordSet rs_d = new RecordSet();
rs_d.executeSql("select id from HrmDepartment where id <> " + deptId + " and supdepid = "+deptId);
while(rs_d.next()){
ids += ","+rs_d.getString(1);
ids = this.getAllDeptId(rs_d.getString(1), ids);
}
return ids;
}
%>
<!-- added by wcd 2014-07-08 end -->
<%
String mode=Prop.getPropValue(GCONST.getConfigFile() , "authentic");
String tabid = Util.null2String(request.getParameter("tabid"));
String nodeid = Util.null2String(request.getParameter("nodeid"));
String groupid = Util.null2String(request.getParameter("groupid"));
String from = Util.null2String(request.getParameter("from"));
String companyid = Util.null2String(request.getParameter("companyid"));
String subcompanyid = Util.null2String(request.getParameter("subcompanyid"));
String departmentid = Util.null2String(request.getParameter("departmentid"));
String needsystem = Util.null2String(request.getParameter("needsystem"));
String isNoAccount = Util.null2String(request.getParameter("isNoAccount"));
String sqltag=Util.null2String(request.getParameter("sqltag"));
String fromHrmStatusChange = Util.null2String(request.getParameter("fromHrmStatusChange"));
//System.out.println("departmentid"+departmentid);
if(fromHrmStatusChange.length()>0){
isNoAccount = Util.null2String(request.getParameter("isNoAccount"),"1");
}
if(tabid.equals("")) tabid="0";
int uid=user.getUID();
String rem=(String)session.getAttribute("resourcesingle");
if(rem==null){
Cookie[] cks= request.getCookies();
for(int i=0;i<cks.length;i++){
//System.out.println("ck:"+cks[i].getName()+":"+cks[i].getValue());
if(cks[i].getName().equals("resourcesingle"+uid)){
rem=cks[i].getValue();
break;
}
}
}
if(rem!=null)
rem=tabid+rem.substring(1);
else
rem=tabid;
if(!nodeid.equals(""))
rem=rem.substring(0,1)+"|"+nodeid;
session.setAttribute("resourcesingle",rem);
Cookie ck = new Cookie("resourcesingle"+uid,rem);
ck.setMaxAge(30*24*60*60);
response.addCookie(ck);
String[] atts=Util.TokenizerString2(rem,"|");
if(tabid.equals("0")&&atts.length>1){
nodeid=atts[1];
if(nodeid.indexOf("com")>-1){
subcompanyid=nodeid.substring(nodeid.indexOf("_")+1);
//System.out.println("subcompanyid"+subcompanyid);
}
else{
departmentid=nodeid.substring(nodeid.lastIndexOf("_")+1);
//System.out.println("departmentid"+departmentid);
}
}
else if(tabid.equals("1") && atts.length>1) {
groupid=atts[1];
}
//System.out.println("departmentid"+departmentid);
//System.out.println("tabid"+tabid);
Calendar today = Calendar.getInstance();
String currentdate = Util.add0(today.get(Calendar.YEAR), 4) +"-"+
Util.add0(today.get(Calendar.MONTH) + 1, 2) +"-"+
Util.add0(today.get(Calendar.DAY_OF_MONTH), 2) ;
// String lastname = Util.toScreenToEdit(request.getParameter("searchid"),user.getLanguage(),"0");
String lastname = Util.null2String(request.getParameter("lastname"));
String resourcetype = Util.null2String(request.getParameter("resourcetype"));
String resourcestatus = Util.null2String(request.getParameter("resourcestatus"));
String jobtitle = Util.null2String(request.getParameter("jobtitle"));
//String departmentid = Util.null2String(request.getParameter("departmentid"));
String sqlwhere = Util.null2String(request.getParameter("sqlwhere"));
boolean hasSqlwhere = false;
if(sqlwhere.length()==0){
sqlwhere = " where 1=1";
}else{
sqlwhere = " where "+sqlwhere;
hasSqlwhere = true;
}
String status = Util.null2String(request.getParameter("status"));
String firstname = Util.null2String(request.getParameter("firstname"));
String seclevelto=Util.fromScreen(request.getParameter("seclevelto"),user.getLanguage());
String roleid = Util.null2String(request.getParameter("roleid"));
//added by wcd 2014-07-08 start
String alllevel = Util.null2String(request.getParameter("alllevel"),"1");
String search = Util.null2String(request.getParameter("search"));
//added by wcd 2014-07-08 end
boolean isoracle = (RecordSet.getDBType()).equals("oracle") ;
if(tabid.equals("0")&&departmentid.equals("")&&sqlwhere.equals("")) departmentid=user.getUserDepartment()+"";
if(departmentid.equals("0")) departmentid="";
if(subcompanyid.equals("0")) subcompanyid="";
/*if(resourcestatus.equals("")) resourcestatus="0" ;
if(resourcestatus.equals("-1")) resourcestatus="" ;*/
if(status.equals("-1")) status = "";
int ishead = 0;
if(!sqlwhere.equals("")) ishead = 1;
if(!lastname.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where (lastname like '%"+Util.fromScreen2(lastname,user.getLanguage())+"%' or pinyinlastname like '%"+Util.fromScreen2(lastname,user.getLanguage()).toLowerCase()+"%')";
}
else
sqlwhere += " and( lastname like '%" + Util.fromScreen2(lastname,user.getLanguage()) +"%' or pinyinlastname like '%"+Util.fromScreen2(lastname,user.getLanguage()).toLowerCase()+"%')";
}
if(!firstname.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where firstname like '%" + Util.fromScreen2(firstname,user.getLanguage()) +"%' ";
}
else
sqlwhere += " and firstname like '%" + Util.fromScreen2(firstname,user.getLanguage()) +"%' ";
}
if(!seclevelto.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where hr.seclevel <= '"+ seclevelto + "' ";
}
else
sqlwhere += " and hr.seclevel <= '"+ seclevelto + "' ";
}
if(!resourcetype.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where resourcetype = '"+ resourcetype + "' ";
}
else
sqlwhere += " and resourcetype = '"+ resourcetype + "' ";
}
/*
if(!resourcestatus.equals("")){
if(ishead==0){
ishead = 1;
if(resourcestatus.equals("0"))
sqlwhere += " where (((startdate='' or startdate is null) or '"+currentdate+"'>=startdate ) and ((enddate='' or enddate is null) or '"+currentdate+"'<= enddate )) ";
else {
if( !isoracle )
sqlwhere += " where (((startdate<>'' and startdate is not null) and '"+currentdate+"'<=startdate) or ((enddate<>'' and enddate is not null) and '"+currentdate+"'>= enddate)) ";
else
sqlwhere += " where ((startdate is not null and '"+currentdate+"'<=startdate) or (enddate is not null and '"+currentdate+"'>= enddate)) ";
}
}
else {
if(resourcestatus.equals("0"))
sqlwhere += " and (((startdate='' or startdate is null) or '"+currentdate+"'>=startdate ) and ((enddate='' or enddate is null) or '"+currentdate+"'<= enddate )) ";
else {
if( !isoracle )
sqlwhere += " and (((startdate<>'' and startdate is not null) and '"+currentdate+"'<=startdate) or ((enddate<>'' and enddate is not null) and '"+currentdate+"'>= enddate)) ";
else
sqlwhere += " and ((startdate is not null and '"+currentdate+"'<=startdate) or (enddate is not null and '"+currentdate+"'>= enddate)) ";
}
}
}
*/
if(!jobtitle.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where jobtitle in(select id from HrmJobTitles where jobtitlename like '%" + Util.fromScreen2(jobtitle,user.getLanguage()) +"%') ";
//sqlwhere += " where jobtitle = " + jobtitle;
}
else
sqlwhere += " and jobtitle in(select id from HrmJobTitles where jobtitlename like '%" + Util.fromScreen2(jobtitle,user.getLanguage()) +"%') ";
//sqlwhere += " and jobtitle = " + jobtitle;
}
if(tabid.equals("0")&&alllevel.equals("1")){
//包含下级机构不需要,
}else{
if(!departmentid.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where departmentid =" + departmentid +" " ;
}
else
sqlwhere += " and departmentid =" + departmentid +" " ;
}
}
if(tabid.equals("0")&&alllevel.equals("1")){
//包含下级机构不需要,
}
else{
if(departmentid.equals("")&&!subcompanyid.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where subcompanyid1 =" + subcompanyid +" " ;
}
else
sqlwhere += " and subcompanyid1 =" + subcompanyid +" " ;
}
}
if(!status.equals("")&&!status.equals("9")){
if(ishead==0){
ishead = 1;
sqlwhere += " where status =" + status +" " ;
}
else
sqlwhere += " and status =" + status +" " ;
}
if(status.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where (status =0 or status = 1 or status = 2 or status = 3) " ;
}
else
sqlwhere += " and (status =0 or status = 1 or status = 2 or status = 3) ";
}
if(fromHrmStatusChange.equals("")){
String roleSql = " SELECT distinct resourceid FROM ( "+
" SELECT a.id AS resourceid, b.roleid , b.rolelevel FROM HrmResource a, HrmRoleMembers b "+
" WHERE (a.id=b.resourceid and b.resourcetype=1) "+
" UNION ALL "+
" SELECT a.id AS resourceid, b.roleid , b.rolelevel FROM HrmResourceManager a, HrmRoleMembers b "+
" WHERE (a.id=b.resourceid and b.resourcetype IN(7,8)) "+
" UNION ALL "+
" SELECT a.id AS resourceid, b.roleid , b.rolelevel FROM HrmResource a, HrmRoleMembers b "+
" WHERE (a.subcompanyid1 = b.resourceid AND a.seclevel>=b.seclevelfrom AND a.seclevel<=b.seclevelto AND b.resourcetype=2) "+
" UNION ALL "+
" SELECT a.id AS resourceid, b.roleid , b.rolelevel FROM HrmResource a, HrmRoleMembers b "+
" WHERE (a.departmentid = b.resourceid AND a.seclevel>=b.seclevelfrom AND a.seclevel<=b.seclevelto AND b.resourcetype=3) "+
" UNION ALL "+
" SELECT a.id AS resourceid, b.roleid , b.rolelevel FROM HrmResource a, HrmRoleMembers b "+
" WHERE (a.jobtitle = b.resourceid AND b.resourcetype=5 AND (b.jobtitlelevel=1 OR (b.jobtitlelevel=2 AND a.subcompanyid1 IN(b.subdepid)) OR (b.jobtitlelevel=3 AND a.departmentid IN(b.subdepid))))) t "+
" WHERE roleid= "+roleid;
if(!roleid.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where hr.ID in ("+roleSql+" ) " ;
}
else
sqlwhere += " and hr.ID in ("+roleSql+" ) " ;
}
}
String noAccountSql="";
if(StringUtils.isNotBlank(sqltag)){
//String[] sqls={" (departmentid is not null "+(RecordSet.getDBType().equals("oracle")?"":" and departmentid<>'' ")+" and (account is null "+(RecordSet.getDBType().equals("oracle")?"":" or account='' ")+")) "};
String[] sqls={" (departmentid is not null "+(RecordSet.getDBType().equals("oracle")?"":" and departmentid<>'' ")+" and (loginid is null "+(RecordSet.getDBType().equals("oracle")?"":" or loginid='' ")+")) "};
if(ishead==0){
ishead = 1;
noAccountSql = " where "+sqls[Util.getIntValue(sqltag)] ;
}
else
noAccountSql = " and " +sqls[Util.getIntValue(sqltag)] ;
}
if(!isNoAccount.equals("1") && StringUtils.isBlank(sqltag)){
if(mode==null||!mode.equals("ldap")){
if(ishead==0){
ishead = 1;
noAccountSql=" where loginid is not null "+(RecordSet.getDBType().equals("oracle")?"":" and loginid<>'' ");
}else{
noAccountSql=" and loginid is not null "+(RecordSet.getDBType().equals("oracle")?"":" and loginid<>'' ");
}
}else{
//loginid、account字段整合 qc:128484
//if(ishead==0){
// ishead = 1;
// noAccountSql=" where account is not null "+(RecordSet.getDBType().equals("oracle")?"":" and account<>'' ");
//}else{
// noAccountSql=" and account is not null "+(RecordSet.getDBType().equals("oracle")?"":" and account<>'' ");
//}
if(ishead==0){
ishead = 1;
noAccountSql=" where loginid is not null "+(RecordSet.getDBType().equals("oracle")?"":" and loginid<>'' ");
}else{
noAccountSql=" and loginid is not null "+(RecordSet.getDBType().equals("oracle")?"":" and loginid<>'' ");
}
}
}
sqlwhere=sqlwhere+(isNoAccount.equals("1")?"":noAccountSql); //是否显示无账号人员
if(adci.isUseAppDetach()){
String appdetawhere = adci.getScopeSqlByHrmResourceSearch(user.getUID()+"",false, "resource_hr");
String tempstr= (appdetawhere!=null&&!"".equals(appdetawhere)?(" and " + appdetawhere):"");
sqlwhere+=tempstr;
}
/*String sqlstr = "select hr.id,lastname,resourcetype,startdate,enddate,jobtitlename,departmentid "+
"from HrmResource hr, HrmJobTitles " + sqlwhere ;
if(ishead ==0) sqlstr += "where HrmJobTitles.id = hr.jobtitle " ;
else sqlstr += " and HrmJobTitles.id = hr.jobtitle " ;*/
String sqlstr = "";
if(mode==null||!mode.equals("ldap")){//win
if(from.equals("add")){
sqlstr = "select hr.id,lastname,departmentid,jobtitle "+
"from HrmResource hr " + sqlwhere+" and (accounttype is null or accounttype=0) order by dsporder,lastname"; ;
if(tabid.equals("1")&&!groupid.equals("")){
sqlstr="select hr.id,hr.lastname,hr.departmentid,hr.jobtitle from hrmresource hr,HrmGroupMembers t2 where (hr.accounttype is null or hr.accounttype=0) and hr.id=t2.userid and t2.groupid="+groupid+(isNoAccount.equals("1")?"":noAccountSql)+" order by hr.dsporder,hr.lastname";
}
if(tabid.equals("0")&&!companyid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr where (accounttype is null or accounttype=0) and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
sqlstr+=" order by dsporder,lastname";
}else if(tabid.equals("0")&&!subcompanyid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr where (accounttype is null or accounttype=0) and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
//added by wcd 2014-07-08 start
//增加查询包含所有子分部人员
String allsubId = subcompanyid;
if(alllevel.equals("1")){//判断是否包含子分部
allsubId = this.getAllSubId(subcompanyid,subcompanyid);
}
sqlstr+=" and subcompanyid1 in("+allsubId+") order by dsporder,lastname";
//added by wcd 2014-07-08 end
}else if(tabid.equals("0")&&!departmentid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr where (accounttype is null or accounttype=0) and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
//added by wcd 2014-07-08 start
//增加查询包含所有子部门人员
String alldeptId = departmentid;
if(alllevel.equals("1")){//判断是否包含子部门
alldeptId = this.getAllDeptId(departmentid,departmentid);
}
sqlstr+=" and departmentid in("+alldeptId+") order by dsporder,lastname";
//added by wcd 2014-07-08 end
}
}else{
sqlstr = "select hr.id,lastname,departmentid,jobtitle "+
"from HrmResource hr " + sqlwhere+" order by dsporder,lastname"; ;
if(tabid.equals("1")&&!groupid.equals("")){
sqlstr="select hr.id,hr.lastname,hr.departmentid,hr.jobtitle from hrmresource hr,HrmGroupMembers t2 where hr.id=t2.userid and t2.groupid="+groupid+(isNoAccount.equals("1")?"":noAccountSql)+" order by hr.dsporder,hr.lastname";
}
if(tabid.equals("0")&&!companyid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
sqlstr+=" order by dsporder,lastname";
}else if(tabid.equals("0")&&!subcompanyid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
//added by wcd 2014-07-08 start
//增加查询包含所有子分部人员
String allsubId = subcompanyid;
if(alllevel.equals("1")){//判断是否包含子分部
allsubId = this.getAllSubId(subcompanyid,subcompanyid);
}
sqlstr+=" and subcompanyid1 in("+allsubId+") order by dsporder,lastname";
//added by wcd 2014-07-08 end
}else if(tabid.equals("0")&&!departmentid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
//added by wcd 2014-07-08 start
//增加查询包含所有子部门人员
String alldeptId = departmentid;
if(alllevel.equals("1")){//判断是否包含子部门
alldeptId = this.getAllDeptId(departmentid,departmentid);
}
sqlstr+=" and departmentid in("+alldeptId+") order by dsporder,lastname";
//added by wcd 2014-07-08 end
}
}
}else{//ldap
if(from.equals("add")){
sqlstr = "select hr.id,lastname,departmentid,jobtitle "+
"from HrmResource hr " + sqlwhere+" and (accounttype is null or accounttype=0) order by dsporder,lastname"; ;
if(tabid.equals("1")&&!groupid.equals("")){
sqlstr="select hr.id,hr.lastname,hr.departmentid,hr.jobtitle from hrmresource hr,HrmGroupMembers t2 " + sqlwhere+" and (hr.accounttype is null or hr.accounttype=0) and hr.id=t2.userid and t2.groupid="+groupid+(isNoAccount.equals("1")?"":noAccountSql)+" order by hr.dsporder,hr.lastname";
}
if(tabid.equals("0")&&!companyid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (accounttype is null or accounttype=0) and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
sqlstr+=" order by dsporder,lastname";
}else if(tabid.equals("0")&&!subcompanyid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (accounttype is null or accounttype=0) and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
//added by wcd 2014-07-08 start
//增加查询包含所有子分部人员
String allsubId = subcompanyid;
if(alllevel.equals("1")){//判断是否包含子分部
allsubId = this.getAllSubId(subcompanyid,subcompanyid);
}
sqlstr+=" and subcompanyid1 in("+allsubId+") order by dsporder,lastname";
//added by wcd 2014-07-08 end
}else if(tabid.equals("0")&&!departmentid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (accounttype is null or accounttype=0) and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
//added by wcd 2014-07-08 start
//增加查询包含所有子部门人员
String alldeptId = departmentid;
if(alllevel.equals("1")){//判断是否包含子部门
alldeptId = this.getAllDeptId(departmentid,departmentid);
}
sqlstr+=" and departmentid in("+alldeptId+") order by dsporder,lastname";
//added by wcd 2014-07-08 end
}
}else{
sqlstr = "select hr.id,lastname,departmentid,jobtitle "+
"from HrmResource hr " + sqlwhere+" order by dsporder,lastname"; ;
if(tabid.equals("1")&&!groupid.equals("")){
sqlstr="select hr.id,hr.lastname,hr.departmentid,hr.jobtitle from hrmresource hr,HrmGroupMembers t2 " + sqlwhere+" and hr.id=t2.userid and t2.groupid="+groupid+(isNoAccount.equals("1")?"":noAccountSql)+" order by hr.dsporder,hr.lastname";
}
if(tabid.equals("0")&&!companyid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
sqlstr+=" order by dsporder,lastname";
}else if(tabid.equals("0")&&!subcompanyid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
//added by wcd 2014-07-08 start
//增加查询包含所有子分部人员
String allsubId = subcompanyid;
if(alllevel.equals("1")){//判断是否包含子分部
allsubId = this.getAllSubId(subcompanyid,subcompanyid);
}
sqlstr+=" and subcompanyid1 in("+allsubId+") order by dsporder,lastname";
//added by wcd 2014-07-08 end
}else if(tabid.equals("0")&&!departmentid.equals("")){
sqlstr="select id,lastname,departmentid,jobtitle from hrmresource hr " + sqlwhere+" and (status =0 or status = 1 or status = 2 or status = 3) "+(isNoAccount.equals("1")?"":noAccountSql);
//added by wcd 2014-07-08 start
//增加查询包含所有子部门人员
String alldeptId = departmentid;
if(alllevel.equals("1")){//判断是否包含子部门
alldeptId = this.getAllDeptId(departmentid,departmentid);
}
sqlstr+=" and departmentid in("+alldeptId+") order by dsporder,lastname";
//added by wcd 2014-07-08 end
}
}
}
//add by alan for td:10343
boolean isInit = Util.null2String(request.getParameter("isinit")).equals("");//是否点击过搜索
if(!hasSqlwhere){
if((tabid.equals("2") && isInit) ||(tabid.equals("0") && nodeid.equals(""))) sqlstr = "select hr.id,lastname,departmentid,jobtitle from HrmResource hr WHERE 1=2";
}
%>
<HTML><HEAD>
<LINK REL=stylesheet type=text/css HREF=/css/Weaver_wev8.css>
<script type="text/javascript">
var dialog = null;
try{
dialog = parent.parent.parent.getDialog(parent.parent);
}
catch(e){}
</script>
</HEAD>
<BODY>
<%//@ include file="/systeminfo/RightClickMenuConent.jsp" %>
<%//@ include file="/systeminfo/RightClickMenu.jsp" %>
<div class="zDialog_div_content">
<table id="topTitle" cellpadding="0" cellspacing="0">
<tr>
<td>
</td>
<td class="rightSearchSpan" style="text-align:right;">
<input type="button" class="e8_btn_top" onclick="btnsub_onclick();" id="btnsub" <%if(!tabid.equals("2")){%>style="display:none"<%}%> value="<%=SystemEnv.getHtmlLabelName(197,user.getLanguage())%>">
<span title="<%=SystemEnv.getHtmlLabelName(23036,user.getLanguage())%>" class="cornerMenu"></span>
</td>
</tr>
</table>
<!--########Browser Table Start########-->
<TABLE width=100% class="BroswerStyle" cellspacing="0" STYLE="margin-top:0">
<tr>
<td colspan="3" align="right">
<%if(tabid.equals("0")){ %>
<input type="checkbox" id="alllevel" name="alllevel" value="1" <%=alllevel.equals("1")?"checked='checked'":""%>/><%=SystemEnv.getHtmlLabelName(33454,user.getLanguage())%>
<input class=inputstyle type="hidden" name="search" value="1">
<%} %>
<% if(StringUtils.isBlank(sqltag)){ %>
<input type="checkbox" value="1" name="isNoAccount" id="isNoAccount" <%=isNoAccount.equals("1")?"checked='checked'":""%>><%=SystemEnv.getHtmlLabelName(31504,user.getLanguage())%>
<% } %>
</td>
</tr>
</TABLE>
<!-- <div id="tableList" style="overflow-y:scroll;width:100%;height:295px"> </div> -->
<%
//out.println(sqlstr);
String tableString=""+
"<table instanceid=\"BrowseTable\" pageId=\""+PageIdConst.HRM_Select+"\" pagesize=\""+PageIdConst.getPageSize(PageIdConst.HRM_Select,user.getUID(),PageIdConst.HRM)+"\" datasource=\"weaver.hrm.HrmDataSource.getHrmResourceList\" sourceparams=\"needsystem:"+needsystem+"+sqlstr:"+Util.toHtmlForSplitPage(sqlstr)+"\" tabletype=\"none\">"+
"<sql backfields=\"*\" sqlform=\"temp\" sqlorderby=\"id\" sqlprimarykey=\"id\" sqlsortway=\"desc\" />"+
"<head>";
tableString+= "<col width=\"0%\" hide=\"true\" text=\""+SystemEnv.getHtmlLabelName(413,user.getLanguage())+"\" column=\"ids\" orderkey=\"ids\"/>";
tableString+= "<col width=\"30%\" text=\""+SystemEnv.getHtmlLabelName(413,user.getLanguage())+"\" column=\"lastnames\" orderkey=\"lastnames\"/>";
tableString += "<col width=\"30%\" text=\""+SystemEnv.getHtmlLabelName(6086,user.getLanguage())+"\" column=\"jobtitlenames\" orderkey=\"jobtitlenames\"/>";
tableString += "<col width=\"30%\" text=\""+SystemEnv.getHtmlLabelName(124,user.getLanguage())+"\" column=\"departmentids\" orderkey=\"departmentids\" transmethod=\"weaver.hrm.company.DepartmentComInfo.getDepartmentname\"/>"+
"</head>"+
"</table>";
%>
<input type="hidden" name="pageId" id="pageId" value="<%=PageIdConst.HRM_Select %>"/>
<wea:SplitPageTag tableString='<%=tableString%>' isShowTopInfo="false" mode="run"/>
<div id="zDialog_div_bottom" class="zDialog_div_bottom">
<wea:layout needImportDefaultJsAndCss="false">
<wea:group context="">
<wea:item type="toolbar">
<input type="button" class="zd_btn_submit" onclick="btnclear_onclick();" id="btnclear" value="<%=SystemEnv.getHtmlLabelName(311,user.getLanguage())%>">
<input type="button" class="zd_btn_cancle" onclick="btncancel_onclick();" id="btncancel" value="<%=SystemEnv.getHtmlLabelName(201,user.getLanguage())%>">
</wea:item>
</wea:group>
</wea:layout>
<script type="text/javascript">
jQuery(document).ready(function(){
resizeDialog(document);
});
</script>
</div>
<script language="javascript">
function btnclear_onclick(){
var returnjson = {id:"",name:""};
if(dialog){
try{
dialog.callback(returnjson);
}catch(e){}
try{
dialog.close(returnjson);
}catch(e){}
}else{
window.parent.parent.returnValue = returnjson;
window.parent.parent.close();
}
}
function btnsub_onclick(){
window.parent.frame1.document.SearchForm.btnsub.click();
}
function btncancel_onclick(){
if(dialog){
dialog.close();
}else{
window.parent.parent.close();
}
}
function replaceToHtml(str){
var re = str;
var re1 = "<";
var re2 = ">";
do{
re = re.replace(re1,"<");
re = re.replace(re2,">");
re = re.replace(",",",");
}while(re.indexOf("<")!=-1 || re.indexOf(">")!=-1)
return re;
}
function BrowseTable_onmouseover(e){
e=e||event;
var target=e.srcElement||e.target;
if("TD"==target.nodeName){
jQuery(target).parents("tr")[0].className = "Selected";
}else if("A"==target.nodeName){
jQuery(target).parents("tr")[0].className = "Selected";
}
}
function BrowseTable_onmouseout(e){
var e=e||event;
var target=e.srcElement||e.target;
var p;
if(target.nodeName == "TD" || target.nodeName == "A" ){
p=jQuery(target).parents("tr")[0];
if( p.rowIndex % 2 ==0){
p.className = "DataDark"
}else{
p.className = "DataLight"
}
}
}
function BrowseTable_onclick(e){
var e=e||event;
var target=e.srcElement||e.target;
if( target.nodeName =="TD"||target.nodeName =="A" ){
var curTr=jQuery(target).parents("tr")[0];
var returnjson = {
id:jQuery(curTr.cells[0]).text(),
name:replaceToHtml(jQuery(curTr.cells[1]).text()),
a1:jQuery(curTr.cells[3]).text(),
a2:jQuery(curTr.cells[4]).text()};
if(dialog){
try{
dialog.callback(returnjson);
}catch(e){}
try{
dialog.close(returnjson);
}catch(e){}
}else{
window.parent.parent.returnValue = returnjson;
window.parent.parent.close();
}
}
}
function afterDoWhenLoaded(){
$("#_xTable").find("table.ListStyle tbody").children("tr[class!='Spacing']").each(function(){
var tr = jQuery(this);
tr.bind("click",function(){
var id = tr.children("td:first").next().text();
var name = tr.children("td:first").next().next().text();
var a1 = tr.children("td:first").next().next().next().text();
var a2 = tr.children("td:first").next().next().next().next().text();
var returnjson = {'id':id,'name':name,'a1':a1,'a2':a2};
if(dialog){
try{
dialog.callback(returnjson);
}catch(e){}
try{
dialog.close(returnjson);
}catch(e){}
}else{
window.parent.parent.returnValue = returnjson;
window.parent.parent.close();
}
});
});
}
jQuery(document).ready(function(){
//$("#BrowseTable").mouseover(BrowseTable_onmouseover);
//$("#BrowseTable").mouseout(BrowseTable_onmouseout);
//$("#BrowseTable").click(BrowseTable_onclick);
//$("#btncancel").click(btncancel_onclick);
//$("#btnsub").click(btnsub_onclick);
//$("#btnclear").click(btnclear_onclick);
});
</script>
</BODY>
</HTML>