Przeglądaj źródła

按id查询专家信息返回参数增加机构名称

zzy.zhiyuan.foxmail 8 lat temu
rodzic
commit
e4a7e4c197

+ 65 - 4
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

@ -17,7 +17,6 @@ import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
17 17
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
18 18
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
19 19
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
20
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
21 20
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
22 21
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
23 22
import org.jfw.apt.orm.annotation.dao.param.Set;
@ -53,9 +52,71 @@ public abstract class ProfessorDao {
53 52
	@From(Professor.class)
54 53
	public abstract int updateAddress(Connection con, String id, @Set String address) throws SQLException;
55 54
	
56
	@Nullable
57
	@SelectOne
58
	public abstract Professor query(Connection con, String id) throws SQLException;
55
	public Professor query(Connection con, String id) throws SQLException{
56
        int _m_1 = 1;
57
        String sql = "SELECT P.OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,P.DEPARTMENT,ORG_ID,P.TITLE,AUTHENTICATION,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,ORGANIZATION.NAME FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
58
        PreparedStatement ps = con.prepareStatement(sql);
59
        try{
60
            ps.setString(_m_1++,id);
61
            ResultSet rs = ps.executeQuery();
62
            try{
63
                if(rs.next()){
64
                    Professor _result = new Professor();
65
                    String _m_2 = rs.getString(1);
66
                    if(rs.wasNull()){
67
                        _m_2 = null;
68
                    }
69
                    _result.setOffice(_m_2);
70
                    String _m_3 = rs.getString(2);
71
                    if(rs.wasNull()){
72
                        _m_3 = null;
73
                    }
74
                    _result.setSubject(_m_3);
75
                    String _m_4 = rs.getString(3);
76
                    if(rs.wasNull()){
77
                        _m_4 = null;
78
                    }
79
                    _result.setIndustry(_m_4);
80
                    String _m_5 = rs.getString(4);
81
                    if(rs.wasNull()){
82
                        _m_5 = null;
83
                    }
84
                    _result.setAddress(_m_5);
85
                    String _m_6 = rs.getString(5);
86
                    if(rs.wasNull()){
87
                        _m_6 = null;
88
                    }
89
                    _result.setDepartment(_m_6);
90
                    Organization organization = new Organization();
91
                    organization.setId(rs.getString(6));
92
                    String _m_7 = rs.getString(7);
93
                    if(rs.wasNull()){
94
                        _m_7 = null;
95
                    }
96
                    _result.setTitle(_m_7);
97
                    _result.setAuthentication("1".equals(rs.getString(8)));
98
                    _result.setId(rs.getString(9));
99
                    _result.setName(rs.getString(10));
100
                    String _m_8 = rs.getString(11);
101
                    if(rs.wasNull()){
102
                        _m_8 = null;
103
                    }
104
                    _result.setDescp(_m_8);
105
                    _result.setCreateTime(rs.getString(12));
106
                    _result.setModifyTime(rs.getString(13));
107
                    organization.setName(rs.getString(14));
108
                    _result.setOrganization(organization);
109
                    return _result;
110
                }else{
111
                    return null;
112
                }
113
            }finally{
114
                try{rs.close();}catch(Exception _m_9){}
115
            }
116
        }finally{
117
            try{ps.close();}catch(Exception _m_10){}
118
        }
119
    }
59 120

60 121
//	@SelectList
61 122
//	public abstract List<Professor> query(Connection con) throws SQLException;