Browse Source

解决专家和资源相关接口的undefined问题。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
753127f15e

+ 118 - 39
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

@ -79,23 +79,39 @@ public abstract class ProfessorDao {
79 79
	 * @throws SQLException
80 80
	 */
81 81
	public EditProfessor queryBaseInfo(Connection con, String id) throws SQLException {
82
		int _m_1 = 1;
82
		int index = 1;
83 83
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,P.ID,P.NAME,P.ADDRESS,ORGANIZATION.NAME "
84 84
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
85 85
        PreparedStatement ps = con.prepareStatement(sql);
86 86
        try{
87
            ps.setString(_m_1++,id);
87
            ps.setString(index++,id);
88 88
            ResultSet rs = ps.executeQuery();
89 89
            try{
90 90
                if(rs.next()){
91 91
                	EditProfessor professor = new EditProfessor();
92
                    professor.setOffice(rs.getString(1));
93
                    professor.setDepartment(rs.getString(2));
94
                    professor.setTitle(rs.getString(3));
92
                	String office = rs.getString(1);
93
                	if(rs.wasNull()){
94
                		office = null;
95
                	}
96
                    professor.setOffice(office);
97
                    String depart = rs.getString(2);
98
                    if(rs.wasNull()){
99
                    	depart = null;
100
                	}
101
                    professor.setDepartment(depart);
102
                    String title = rs.getString(3);
103
                    if(rs.wasNull()){
104
                    	title = null;
105
                	}
106
                    professor.setTitle(title);
95 107
                    professor.setAuthentication("1".equals(rs.getString(4)));
96 108
                    professor.setId(rs.getString(5));
97 109
                    professor.setName(rs.getString(6));
98
                    professor.setAddress(rs.getString(7));
110
                    String address = rs.getString(7);
111
                    if(rs.wasNull()){
112
                    	address = null;
113
                	}
114
                    professor.setAddress(address);
99 115
                    professor.setOrgName(rs.getString(8));
100 116
                    return professor;
101 117
                }else{
@ -117,29 +133,41 @@ public abstract class ProfessorDao {
117 133
	 * @throws SQLException
118 134
	 */
119 135
	public EditProfessor queryEditBaseInfo(Connection con, String id) throws SQLException {
120
		int _m_1 = 1;
136
		int index = 1;
121 137
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,P.ID,P.NAME,"
122 138
        		+ " P.ADDRESS,P.STAR_LEVEL,P.CONSULT_COUNT,ORGANIZATION.NAME "
123 139
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
124 140
        PreparedStatement ps = con.prepareStatement(sql);
125 141
        try{
126
            ps.setString(_m_1++,id);
142
            ps.setString(index++,id);
127 143
            ResultSet rs = ps.executeQuery();
128 144
            try{
129 145
                if(rs.next()){
130 146
                	EditProfessor professor = new EditProfessor();
131
                    professor.setOffice(rs.getString(1));
132
                    professor.setDepartment(rs.getString(2));
133
                    professor.setTitle(rs.getString(3));
147
                	String office = rs.getString(1);
148
                	if(rs.wasNull()){
149
                		office = null;
150
                	}
151
                    professor.setOffice(office);
152
                    String depart = rs.getString(2);
153
                	if(rs.wasNull()){
154
                		depart = null;
155
                	}
156
                    professor.setDepartment(depart);
157
                    String title = rs.getString(3);
158
                	if(rs.wasNull()){
159
                		title = null;
160
                	}
161
                    professor.setTitle(title);
134 162
                    professor.setAuthentication("1".equals(rs.getString(4)));
135 163
                    professor.setId(rs.getString(5));
136 164
                    professor.setName(rs.getString(6));
137
                    professor.setAddress(rs.getString(7));
138
                    BigDecimal starLevel = rs.getBigDecimal(8);
139
                    if(rs.wasNull()){
140
                    	starLevel = null;
141
                    }
142
                    professor.setStarLevel(starLevel);
165
                    String address = rs.getString(7);
166
                	if(rs.wasNull()){
167
                		address = null;
168
                	}
169
                    professor.setAddress(address);
170
                    professor.setStarLevel(rs.getBigDecimal(8));
143 171
                    professor.setConsultCount(rs.getInt(9));
144 172
                    professor.setOrgName(rs.getString(10));
145 173
                    return professor;
@ -147,10 +175,10 @@ public abstract class ProfessorDao {
147 175
                    return null;
148 176
                }
149 177
            }finally{
150
                try{rs.close();}catch(Exception _m_9){}
178
                try{rs.close();}catch(Exception e1){}
151 179
            }
152 180
        }finally{
153
            try{ps.close();}catch(Exception _m_10){}
181
            try{ps.close();}catch(Exception e2){}
154 182
        }
155 183
	}
156 184
	
@ -220,7 +248,6 @@ public abstract class ProfessorDao {
220 248
        }
221 249
    }
222 250

223
//	@SelectList
224 251
//	public abstract List<Professor> query(Connection con) throws SQLException;
225 252
	
226 253
	public List<Professor> query(Connection con) throws SQLException{
@ -493,13 +520,21 @@ public abstract class ProfessorDao {
493 520
				_result.setData(_m_11);
494 521
				while (rs.next()) {
495 522
					EditProfessor professor =  new EditProfessor();
496
                    String _m_1 = rs.getString(1);
523
                    String office = rs.getString(1);
497 524
                    if(rs.wasNull()){
498
                        _m_1 = null;
525
                    	office = null;
526
                    }
527
                    professor.setOffice(office);
528
                    String address = rs.getString(2);
529
                    if(rs.wasNull()){
530
                    	address = null;
531
                    }
532
                    professor.setAddress(address);
533
                    String title = rs.getString(3);
534
                    if(rs.wasNull()){
535
                    	title = null;
499 536
                    }
500
                    professor.setOffice(_m_1);
501
                    professor.setAddress(rs.getString(2));
502
                    professor.setTitle(rs.getString(3));
537
                    professor.setTitle(title);
503 538
                    professor.setAuthentication("1".equals(rs.getString(4)));
504 539
                    professor.setId(rs.getString(5));
505 540
                    professor.setName(rs.getString(6));
@ -687,13 +722,21 @@ public abstract class ProfessorDao {
687 722
				_result.setData(_m_11);
688 723
				while (rs.next()) {
689 724
					EditProfessor professor =  new EditProfessor();
690
                    String _m_1 = rs.getString(1);
725
                    String office = rs.getString(1);
691 726
                    if(rs.wasNull()){
692
                        _m_1 = null;
727
                    	office = null;
693 728
                    }
694
                    professor.setOffice(_m_1);
695
                    professor.setAddress(rs.getString(2));
696
                    professor.setTitle(rs.getString(3));
729
                    professor.setOffice(office);
730
                    String addr = rs.getString(2);
731
                    if(rs.wasNull()){
732
                    	addr = null;
733
                    }
734
                    professor.setAddress(addr);
735
                    String title = rs.getString(3);
736
                    if(rs.wasNull()){
737
                    	title = null;
738
                    }
739
                    professor.setTitle(title);
697 740
                    professor.setAuthentication("1".equals(rs.getString(4)));
698 741
                    professor.setId(rs.getString(5));
699 742
                    professor.setName(rs.getString(6));
@ -868,13 +911,37 @@ public abstract class ProfessorDao {
868 911
				_result.setData(_m_11);
869 912
				while (rs.next()) {
870 913
					EditProfessor professor = new EditProfessor();
871
					professor.setOffice(rs.getString(1));
872
					professor.setSubject(rs.getString(2));
873
					professor.setIndustry(rs.getString(3));
874
					professor.setAddress(rs.getString(4));
875
					professor.setDepartment(rs.getString(5));
914
					String office = rs.getString(1);
915
                    if(rs.wasNull()){
916
                    	office = null;
917
                    }
918
                    professor.setOffice(office);
919
                    String subj = rs.getString(2);
920
                    if(rs.wasNull()){
921
                    	subj = null;
922
                    }
923
					professor.setSubject(subj);
924
					String indus = rs.getString(3);
925
					if(rs.wasNull()){
926
						indus = null;
927
					}
928
					professor.setIndustry(indus);
929
					String addr = rs.getString(4);
930
					if(rs.wasNull()){
931
						addr = null;
932
					}
933
					professor.setAddress(addr);
934
					String depart = rs.getString(5);
935
					if(rs.wasNull()){
936
						depart = null;
937
					}
938
					professor.setDepartment(depart);
876 939
					professor.setOrgName(rs.getString(6));
877
					professor.setTitle(rs.getString(7));
940
					String title = rs.getString(7);
941
					if(rs.wasNull()){
942
						title = null;
943
					}
944
					professor.setTitle(title);
878 945
					professor.setAuthentication("1".equals(rs.getString(8)));
879 946
					professor.setId(rs.getString(9));
880 947
					professor.setName(rs.getString(10));
@ -1040,13 +1107,25 @@ public abstract class ProfessorDao {
1040 1107
						_m_15 = null;
1041 1108
					}
1042 1109
					_obj.setIndustry(_m_15);
1043
					_obj.setAddress(rs.getString(4));
1044
					_obj.setDepartment(rs.getString(5));
1110
					String addr = rs.getString(4);
1111
					if(rs.wasNull()){
1112
						addr = null;
1113
					}
1114
					_obj.setAddress(addr);
1115
					String depart = rs.getString(5);
1116
					if(rs.wasNull()){
1117
						depart = null;
1118
					}
1119
					_obj.setDepartment(depart);
1045 1120
					Organization organization = new Organization();
1046 1121
					organization.setId(rs.getString(6));
1047 1122
					organization.setName(rs.getString(7));
1048 1123
					_obj.setOrganization(organization);
1049
					_obj.setTitle(rs.getString(8));
1124
					String title = rs.getString(8);
1125
					if(rs.wasNull()){
1126
						title = null;
1127
					}
1128
					_obj.setTitle(title);
1050 1129
					_obj.setAuthentication("1".equals(rs.getString(9)));
1051 1130
					_obj.setId(rs.getString(10));
1052 1131
					_obj.setName(rs.getString(11));

+ 25 - 5
src/main/java/com/ekexiu/portal/dao/ResourceDao.java

@ -107,7 +107,11 @@ public abstract class ResourceDao {
107 107
                    Professor professor = new Professor();
108 108
                    professor.setId(rs.getString(7));
109 109
                    _result.setAscription(rs.getString(8));
110
                    _result.setHopePayMethod(rs.getString(9));
110
                    String hopePay = rs.getString(9);
111
                    if(rs.wasNull()){
112
                    	hopePay = null;
113
                    }
114
                    _result.setHopePayMethod(hopePay);
111 115
                    String _m_5 = rs.getString(10);
112 116
                    if(rs.wasNull()){
113 117
                        _m_5 = null;
@ -780,10 +784,26 @@ public abstract class ResourceDao {
780 784
                    _obj.setCreateTime(rs.getString(11));
781 785
                    _obj.setModifyTime(rs.getString(12));
782 786
                    professor.setName(rs.getString(13));
783
                    professor.setTitle(rs.getString(14));
784
                    professor.setDepartment(rs.getString(15));
785
                    professor.setAddress(rs.getString(16));
786
                    professor.setOffice(rs.getString(17));
787
                    String title = rs.getString(14);
788
                    if(rs.wasNull()){
789
                    	title = null;
790
                    }
791
                    professor.setTitle(title);
792
                    String depart = rs.getString(15);
793
                    if(rs.wasNull()){
794
                    	depart = null;
795
                    }
796
                    professor.setDepartment(depart);
797
                    String addr = rs.getString(16);
798
                    if(rs.wasNull()){
799
                    	addr = null;
800
                    }
801
                    professor.setAddress(addr);
802
                    String office = rs.getString(17);
803
                    if(rs.wasNull()){
804
                    	office = null;
805
                    }
806
                    professor.setOffice(office);
787 807
                    professor.setOrgName(rs.getString(18));
788 808
                    _obj.setProfessor(professor);
789 809
                    List<Image> images = this.imageDao.queryRes(con, _obj.getResourceId());