Pārlūkot izejas kodu

查询接口中所有传ID需要显示中文名称的地方改成传对象(前台只需对象.属性就可以取值)

zzy.zhiyuan.foxmail 8 gadi atpakaļ
vecāks
revīzija
cda166cd71

+ 150 - 13
src/main/java/com/ekexiu/portal/dao/OperationDao.java

@ -2,15 +2,11 @@ package com.ekexiu.portal.dao;
2 2

3 3
import java.sql.Connection;
4 4
import java.sql.SQLException;
5
import java.util.List;
6 5

7
import org.jfw.apt.annotation.Nullable;
8 6
import org.jfw.apt.orm.annotation.dao.DAO;
9 7
import org.jfw.apt.orm.annotation.dao.method.From;
10 8
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
11 9
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
12
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
14 10
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
15 11
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
16 12

@ -42,18 +38,159 @@ public abstract class OperationDao {
42 38
	@From(Operation.class)
43 39
	public abstract int updatePayMethod(Connection con, String operationId, String payMethod) throws SQLException;
44 40
	
45
	@Nullable
46
	@SelectOne
47
	public abstract Operation query(Connection con, String operationId) throws SQLException;
41
	public com.ekexiu.portal.po.Operation query(java.sql.Connection con,java.lang.String operationId) throws java.sql.SQLException{
42
        int _m_1 = 1;
43
        String sql = "SELECT REPLY_NOTES,OPERATION.CREATE_TIME,OPERATION_ID,OPERATION_STATUS,DEMAND_ID,DETAIL_DEMAND,DELIVER_TIME,OPERATION.RESOURCE_ID,DEAL_PRICE,DEAL_TIME,PAY_METHOD,PROFESSOR.NAME,RESOURCE_NAME FROM OPERATION INNER JOIN PROFESSOR ON DEMAND_ID = PROFESSOR.ID INNER JOIN RESOURCE ON OPERATION.RESOURCE_ID = RESOURCE.RESOURCE_ID WHERE OPERATION_ID = ?";
44
        java.sql.PreparedStatement ps = con.prepareStatement(sql);
45
        try{
46
            ps.setString(_m_1++,operationId);
47
            java.sql.ResultSet rs = ps.executeQuery();
48
            try{
49
                if(rs.next()){
50
                    com.ekexiu.portal.po.Operation _result = new com.ekexiu.portal.po.Operation();
51
                    _result.setReplyNotes(rs.getString(1));
52
                    _result.setCreateTime(rs.getString(2));
53
                    _result.setOperationId(rs.getString(3));
54
                    _result.setOperationStatus(rs.getInt(4));
55
                    Professor professor = new Professor();
56
                    professor.setId(rs.getString(5));
57
                    _result.setDetailDemand(rs.getString(6));
58
                    _result.setDeliverTime(rs.getString(7));
59
                    Resource resource = new Resource();
60
                    resource.setResourceId(rs.getString(8));
61
                    _result.setDealPrice(rs.getBigDecimal(9));
62
                    _result.setDealTime(rs.getString(10));
63
                    _result.setPayMethod(rs.getString(11));
64
                    professor.setName(rs.getString(12));
65
                    _result.setProfessor(professor);
66
                    resource.setResourceName(rs.getString(13));
67
                    _result.setResource(resource);
68
                    return _result;
69
                }else{
70
                    return null;
71
                }
72
            }finally{
73
                try{rs.close();}catch(Exception _m_2){}
74
            }
75
        }finally{
76
            try{ps.close();}catch(Exception _m_3){}
77
        }
78
    }
48 79
	
49
	@SelectList
50
	public abstract List<Operation> query(Connection con) throws SQLException;
80
	public java.util.List<com.ekexiu.portal.po.Operation> query(java.sql.Connection con) throws java.sql.SQLException{
81
        String sql = "SELECT REPLY_NOTES,OPERATION.CREATE_TIME,OPERATION_ID,OPERATION_STATUS,DEMAND_ID,DETAIL_DEMAND,DELIVER_TIME,OPERATION.RESOURCE_ID,DEAL_PRICE,DEAL_TIME,PAY_METHOD,PROFESSOR.NAME,RESOURCE_NAME FROM OPERATION INNER JOIN PROFESSOR ON DEMAND_ID = PROFESSOR.ID INNER JOIN RESOURCE ON OPERATION.RESOURCE_ID = RESOURCE.RESOURCE_ID";
82
        java.sql.PreparedStatement ps = con.prepareStatement(sql);
83
        try{
84
            java.sql.ResultSet rs = ps.executeQuery();
85
            try{
86
                java.util.List<com.ekexiu.portal.po.Operation> _result = new java.util.ArrayList<com.ekexiu.portal.po.Operation>();
87
                while(rs.next()){
88
                    com.ekexiu.portal.po.Operation _obj =  new com.ekexiu.portal.po.Operation();
89
                    _obj.setReplyNotes(rs.getString(1));
90
                    _obj.setCreateTime(rs.getString(2));
91
                    _obj.setOperationId(rs.getString(3));
92
                    _obj.setOperationStatus(rs.getInt(4));
93
                    Professor professor = new Professor();
94
                    professor.setId(rs.getString(5));
95
                    _obj.setDetailDemand(rs.getString(6));
96
                    _obj.setDeliverTime(rs.getString(7));
97
                    Resource resource = new Resource();
98
                    resource.setResourceId(rs.getString(8));
99
                    _obj.setDealPrice(rs.getBigDecimal(9));
100
                    _obj.setDealTime(rs.getString(10));
101
                    _obj.setPayMethod(rs.getString(11));
102
                    professor.setName(rs.getString(12));
103
                    _obj.setProfessor(professor);
104
                    resource.setResourceName(rs.getString(13));
105
                    _obj.setResource(resource);
106
                    _result.add(_obj);
107
                }
108
                return _result;
109
            }finally{
110
                try{rs.close();}catch(Exception _m_1){}
111
            }
112
        }finally{
113
            try{ps.close();}catch(Exception _m_2){}
114
        }
115
    }
51 116
	
52
	@SelectList
53
	public abstract List<Operation> queryPro(Connection con, String demandId) throws SQLException;
117
	public java.util.List<com.ekexiu.portal.po.Operation> queryPro(java.sql.Connection con,java.lang.String demandId) throws java.sql.SQLException{
118
        int _m_1 = 1;
119
        String sql = "SELECT REPLY_NOTES,OPERATION.CREATE_TIME,OPERATION_ID,OPERATION_STATUS,DEMAND_ID,DETAIL_DEMAND,DELIVER_TIME,OPERATION.RESOURCE_ID,DEAL_PRICE,DEAL_TIME,PAY_METHOD,PROFESSOR.NAME,RESOURCE_NAME FROM OPERATION INNER JOIN PROFESSOR ON DEMAND_ID = PROFESSOR.ID INNER JOIN RESOURCE ON OPERATION.RESOURCE_ID = RESOURCE.RESOURCE_ID WHERE DEMAND_ID = ?";
120
        java.sql.PreparedStatement ps = con.prepareStatement(sql);
121
        try{
122
            ps.setString(_m_1++,demandId);
123
            java.sql.ResultSet rs = ps.executeQuery();
124
            try{
125
                java.util.List<com.ekexiu.portal.po.Operation> _result = new java.util.ArrayList<com.ekexiu.portal.po.Operation>();
126
                while(rs.next()){
127
                    com.ekexiu.portal.po.Operation _obj =  new com.ekexiu.portal.po.Operation();
128
                    _obj.setReplyNotes(rs.getString(1));
129
                    _obj.setCreateTime(rs.getString(2));
130
                    _obj.setOperationId(rs.getString(3));
131
                    _obj.setOperationStatus(rs.getInt(4));
132
                    Professor professor = new Professor();
133
                    professor.setId(rs.getString(5));
134
                    _obj.setDetailDemand(rs.getString(6));
135
                    _obj.setDeliverTime(rs.getString(7));
136
                    Resource resource = new Resource();
137
                    resource.setResourceId(rs.getString(8));
138
                    _obj.setDealPrice(rs.getBigDecimal(9));
139
                    _obj.setDealTime(rs.getString(10));
140
                    _obj.setPayMethod(rs.getString(11));
141
                    professor.setName(rs.getString(12));
142
                    _obj.setProfessor(professor);
143
                    resource.setResourceName(rs.getString(13));
144
                    _obj.setResource(resource);
145
                    _result.add(_obj);
146
                }
147
                return _result;
148
            }finally{
149
                try{rs.close();}catch(Exception _m_2){}
150
            }
151
        }finally{
152
            try{ps.close();}catch(Exception _m_3){}
153
        }
154
    }
54 155
	
55
	@SelectList
56
	public abstract List<Operation> queryRes(Connection con, String resourceId) throws SQLException;
156
	public java.util.List<com.ekexiu.portal.po.Operation> queryRes(java.sql.Connection con,java.lang.String resourceId) throws java.sql.SQLException{
157
        int _m_1 = 1;
158
        String sql = "SELECT REPLY_NOTES,OPERATION.CREATE_TIME,OPERATION_ID,OPERATION_STATUS,DEMAND_ID,DETAIL_DEMAND,DELIVER_TIME,OPERATION.RESOURCE_ID,DEAL_PRICE,DEAL_TIME,PAY_METHOD,PROFESSOR.NAME,RESOURCE_NAME FROM OPERATION INNER JOIN PROFESSOR ON DEMAND_ID = PROFESSOR.ID INNER JOIN RESOURCE ON OPERATION.RESOURCE_ID = RESOURCE.RESOURCE_ID WHERE RESOURCE_ID = ?";
159
        java.sql.PreparedStatement ps = con.prepareStatement(sql);
160
        try{
161
            ps.setString(_m_1++,resourceId);
162
            java.sql.ResultSet rs = ps.executeQuery();
163
            try{
164
                java.util.List<com.ekexiu.portal.po.Operation> _result = new java.util.ArrayList<com.ekexiu.portal.po.Operation>();
165
                while(rs.next()){
166
                    com.ekexiu.portal.po.Operation _obj =  new com.ekexiu.portal.po.Operation();
167
                    _obj.setReplyNotes(rs.getString(1));
168
                    _obj.setCreateTime(rs.getString(2));
169
                    _obj.setOperationId(rs.getString(3));
170
                    _obj.setOperationStatus(rs.getInt(4));
171
                    Professor professor = new Professor();
172
                    professor.setId(rs.getString(5));
173
                    _obj.setDetailDemand(rs.getString(6));
174
                    _obj.setDeliverTime(rs.getString(7));
175
                    Resource resource = new Resource();
176
                    resource.setResourceId(rs.getString(8));
177
                    _obj.setDealPrice(rs.getBigDecimal(9));
178
                    _obj.setDealTime(rs.getString(10));
179
                    _obj.setPayMethod(rs.getString(11));
180
                    professor.setName(rs.getString(12));
181
                    _obj.setProfessor(professor);
182
                    resource.setResourceName(rs.getString(13));
183
                    _obj.setResource(resource);
184
                    _result.add(_obj);
185
                }
186
                return _result;
187
            }finally{
188
                try{rs.close();}catch(Exception _m_2){}
189
            }
190
        }finally{
191
            try{ps.close();}catch(Exception _m_3){}
192
        }
193
    }
57 194
	
58 195
	@DeleteWith
59 196
	@From(Operation.class)

+ 102 - 7
src/main/java/com/ekexiu/portal/dao/ResourceDao.java

@ -4,14 +4,12 @@ import java.sql.Connection;
4 4
import java.sql.SQLException;
5 5
import java.util.List;
6 6

7
import org.jfw.apt.annotation.Nullable;
8 7
import org.jfw.apt.orm.annotation.dao.DAO;
9 8
import org.jfw.apt.orm.annotation.dao.method.From;
10 9
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
11 10
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
12 11
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13 12
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
15 13
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
16 14
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
17 15
import org.jfw.apt.orm.annotation.dao.param.Set;
@ -47,12 +45,109 @@ public abstract class ResourceDao {
47 45
	@From(Resource.class)
48 46
	public abstract int updateCooperationNotes(Connection con,String resourceId,@Set String cooperationNotes) throws SQLException;
49 47
	
50
	@Nullable
51
	@SelectOne
52
	public abstract Resource query(Connection con, String resourceId) throws SQLException;
48
	public com.ekexiu.portal.po.Resource query(java.sql.Connection con,java.lang.String resourceId) throws java.sql.SQLException{
49
        int _m_1 = 1;
50
        String sql = "SELECT RESOURCE_ID,RESOURCE_NAME,RESOURCE.SUBJECT,RESOURCE.INDUSTRY,SUPPORTED_SERVICES,RESOURCE.DESCP,PROFESSOR_ID,ASCRIPTION,HOPE_PAY_METHOD,COOPERATION_NOTES,RESOURCE.CREATE_TIME,RESOURCE.MODIFY_TIME,PROFESSOR.NAME FROM RESOURCE LEFT JOIN PROFESSOR ON PROFESSOR_ID = PROFESSOR.ID WHERE RESOURCE_ID = ?";
51
        java.sql.PreparedStatement ps = con.prepareStatement(sql);
52
        try{
53
            ps.setString(_m_1++,resourceId);
54
            java.sql.ResultSet rs = ps.executeQuery();
55
            try{
56
                if(rs.next()){
57
                    com.ekexiu.portal.po.Resource _result = new com.ekexiu.portal.po.Resource();
58
                    _result.setResourceId(rs.getString(1));
59
                    _result.setResourceName(rs.getString(2));
60
                    java.lang.String _m_2 = rs.getString(3);
61
                    if(rs.wasNull()){
62
                        _m_2 = null;
63
                    }
64
                    _result.setSubject(_m_2);
65
                    java.lang.String _m_3 = rs.getString(4);
66
                    if(rs.wasNull()){
67
                        _m_3 = null;
68
                    }
69
                    _result.setIndustry(_m_3);
70
                    _result.setSupportedServices(rs.getString(5));
71
                    java.lang.String _m_4 = rs.getString(6);
72
                    if(rs.wasNull()){
73
                        _m_4 = null;
74
                    }
75
                    _result.setDescp(_m_4);
76
                    Professor professor = new Professor();
77
                    professor.setId(rs.getString(7));
78
                    _result.setAscription(rs.getString(8));
79
                    _result.setHopePayMethod(rs.getString(9));
80
                    java.lang.String _m_5 = rs.getString(10);
81
                    if(rs.wasNull()){
82
                        _m_5 = null;
83
                    }
84
                    _result.setCooperationNotes(_m_5);
85
                    _result.setCreateTime(rs.getString(11));
86
                    _result.setModifyTime(rs.getString(12));
87
                    professor.setName(rs.getString(13));
88
                    _result.setProfessor(professor);
89
                    return _result;
90
                }else{
91
                    return null;
92
                }
93
            }finally{
94
                try{rs.close();}catch(Exception _m_6){}
95
            }
96
        }finally{
97
            try{ps.close();}catch(Exception _m_7){}
98
        }
99
    }
53 100
	
54
	@SelectList
55
	public abstract List<Resource> query(Connection con) throws SQLException;
101
	public java.util.List<com.ekexiu.portal.po.Resource> query(java.sql.Connection con) throws java.sql.SQLException{
102
        String sql = "SELECT RESOURCE_ID,RESOURCE_NAME,RESOURCE.SUBJECT,RESOURCE.INDUSTRY,SUPPORTED_SERVICES,RESOURCE.DESCP,PROFESSOR_ID,ASCRIPTION,HOPE_PAY_METHOD,COOPERATION_NOTES,RESOURCE.CREATE_TIME,RESOURCE.MODIFY_TIME,PROFESSOR.NAME FROM RESOURCE LEFT JOIN PROFESSOR ON PROFESSOR_ID = PROFESSOR.ID";
103
        java.sql.PreparedStatement ps = con.prepareStatement(sql);
104
        try{
105
            java.sql.ResultSet rs = ps.executeQuery();
106
            try{
107
                java.util.List<com.ekexiu.portal.po.Resource> _result = new java.util.ArrayList<com.ekexiu.portal.po.Resource>();
108
                while(rs.next()){
109
                    com.ekexiu.portal.po.Resource _obj =  new com.ekexiu.portal.po.Resource();
110
                    _obj.setResourceId(rs.getString(1));
111
                    _obj.setResourceName(rs.getString(2));
112
                    java.lang.String _m_1 = rs.getString(3);
113
                    if(rs.wasNull()){
114
                        _m_1 = null;
115
                    }
116
                    _obj.setSubject(_m_1);
117
                    java.lang.String _m_2 = rs.getString(4);
118
                    if(rs.wasNull()){
119
                        _m_2 = null;
120
                    }
121
                    _obj.setIndustry(_m_2);
122
                    _obj.setSupportedServices(rs.getString(5));
123
                    java.lang.String _m_3 = rs.getString(6);
124
                    if(rs.wasNull()){
125
                        _m_3 = null;
126
                    }
127
                    _obj.setDescp(_m_3);
128
                    Professor professor = new Professor();
129
                    professor.setId(rs.getString(7));
130
                    _obj.setAscription(rs.getString(8));
131
                    _obj.setHopePayMethod(rs.getString(9));
132
                    java.lang.String _m_4 = rs.getString(10);
133
                    if(rs.wasNull()){
134
                        _m_4 = null;
135
                    }
136
                    _obj.setCooperationNotes(_m_4);
137
                    _obj.setCreateTime(rs.getString(11));
138
                    _obj.setModifyTime(rs.getString(12));
139
                    professor.setName(rs.getString(13));
140
                    _obj.setProfessor(professor);
141
                    _result.add(_obj);
142
                }
143
                return _result;
144
            }finally{
145
                try{rs.close();}catch(Exception _m_5){}
146
            }
147
        }finally{
148
            try{ps.close();}catch(Exception _m_6){}
149
        }
150
    }
56 151
	
57 152
	@SelectList
58 153
	public abstract List<Resource> queryPro(Connection con, String professorId) throws SQLException;