Explorar el Código

--添加查询所有咨询和咨询详细信息的接口(后台运维).

zzy.zhiyuan.foxmail %!s(int64=8) %!d(string=hace) años
padre
commit
67b6b30b37

+ 6 - 0
src/main/java/com/ekexiu/portal/dao/ConsultDao.java

@ -12,7 +12,9 @@ import java.util.List;
12 12
import org.jfw.apt.annotation.Autowrie;
13 13
import org.jfw.apt.annotation.Nullable;
14 14
import org.jfw.apt.orm.annotation.dao.DAO;
15
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
15 16
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
17
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
16 18
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
17 19
import org.jfw.util.PageQueryResult;
18 20

@ -240,6 +242,10 @@ public abstract class ConsultDao {
240 242
	@Nullable
241 243
	public abstract Consult query(Connection con, String consultId) throws SQLException;
242 244
	
245
	@SelectList
246
	@OrderBy("ORDER BY CREATE_TIME DESC")
247
	public abstract List<Consult> query(Connection con) throws SQLException;
248
	
243 249
	/**
244 250
	 * 统计未查看的咨询条数
245 251
	 * @param con

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

@ -291,7 +291,7 @@ public abstract class ProfessorDao {
291 291
	public Professor query(Connection con, String id) throws SQLException{
292 292
        int _m_1 = 1;
293 293
        String sql = "SELECT P.OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,P.DEPARTMENT,ORG_ID,P.TITLE,AUTHENTICATION,"
294
        		+ "AUTH_TYPE,AUTH_STATUS,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,ORGANIZATION.NAME "
294
        		+ "AUTH_TYPE,AUTH_STATUS,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,PHONE,EMAIL,ORGANIZATION.NAME "
295 295
        		+ "FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
296 296
        PreparedStatement ps = con.prepareStatement(sql);
297 297
        try{
@ -344,17 +344,27 @@ public abstract class ProfessorDao {
344 344
                    _result.setDescp(_m_8);
345 345
                    _result.setCreateTime(rs.getString(14));
346 346
                    _result.setModifyTime(rs.getString(15));
347
                    organization.setName(rs.getString(16));
347
                    String _m_9 = rs.getString(16);
348
                    if(rs.wasNull()){
349
                    	_m_9 = null;
350
                    }
351
                    _result.setPhone(_m_9);
352
                    String _m_10 = rs.getString(17);
353
                    if(rs.wasNull()){
354
                    	_m_10 = null;
355
                    }
356
                    _result.setEmail(_m_10);
357
                    organization.setName(rs.getString(18));
348 358
                    _result.setOrganization(organization);
349 359
                    return _result;
350 360
                }else{
351 361
                    return null;
352 362
                }
353 363
            }finally{
354
                try{rs.close();}catch(Exception _m_9){}
364
                try{rs.close();}catch(Exception _m_11){}
355 365
            }
356 366
        }finally{
357
            try{ps.close();}catch(Exception _m_10){}
367
            try{ps.close();}catch(Exception _m_12){}
358 368
        }
359 369
    }
360 370


+ 5 - 0
src/main/java/com/ekexiu/portal/dao/TidingsDao.java

@ -4,9 +4,11 @@ import java.sql.Connection;
4 4
import java.sql.PreparedStatement;
5 5
import java.sql.ResultSet;
6 6
import java.sql.SQLException;
7
import java.util.List;
7 8

8 9
import org.jfw.apt.orm.annotation.dao.DAO;
9 10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
10 12

11 13
import com.ekexiu.portal.po.Consult;
12 14
import com.ekexiu.portal.po.Tidings;
@ -162,6 +164,9 @@ public abstract class TidingsDao {
162 164
        }
163 165
    }
164 166
	
167
	@SelectList
168
	public abstract List<Tidings> queryList(Connection con,String consultId) throws SQLException;
169
	
165 170
	public java.util.List<Tidings> queryCon(Connection con,String consultId) throws SQLException{
166 171
        int _m_1 = 1;
167 172
        String sql = "SELECT TIDINGS_ID,TIDINGS_CONTANT,SENDER_ID,TIDINGS.CONSULT_ID,TIDINGS.CREATE_TIME,PROFESSOR.NAME "

+ 8 - 0
src/main/java/com/ekexiu/portal/po/Consult.java

@ -1,6 +1,7 @@
1 1
package com.ekexiu.portal.po;
2 2

3 3
import java.math.BigDecimal;
4
import java.util.List;
4 5

5 6
import org.jfw.apt.orm.annotation.entry.Column;
6 7
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
@ -35,7 +36,14 @@ public class Consult implements CreateTimeSupported {
35 36
	private String revoveryTime;
36 37
	private Integer readStatus;
37 38
	private EditProfessor professor;
39
	private List<Tidings> tidings;
38 40
	
41
	public List<Tidings> getTidings() {
42
		return tidings;
43
	}
44
	public void setTidings(List<Tidings> tidings) {
45
		this.tidings = tidings;
46
	}
39 47
	public EditProfessor getProfessor() {
40 48
		return professor;
41 49
	}

+ 18 - 0
src/main/java/com/ekexiu/portal/service/ConsultService.java

@ -267,4 +267,22 @@ public class ConsultService {
267 267
		return queryResult;
268 268
	}
269 269
	
270
	@Get
271
	@Path("/qa")
272
	public List<Consult> query(@JdbcConn Connection con) throws SQLException{
273
		List<Consult> consults = this.consultDao.query(con);
274
		return consults;
275
	}
276
	
277
	@Get
278
	@Path("/queryOne")
279
	public Consult queryOne(@JdbcConn Connection con, String consultId) throws SQLException{
280
		Consult consult = this.consultDao.query(con, consultId);
281
		if(consult != null){
282
			List<Tidings> tidings = this.tidingsDao.queryList(con, consultId);
283
			consult.setTidings(tidings);
284
		}
285
		return consult;
286
	}
287
	
270 288
}