XMTT преди 8 години
родител
ревизия
b616c25a8c

+ 252 - 0
src/main/java/com/ekexiu/console/system/dao/ConsultDao.java

@ -0,0 +1,252 @@
1
package com.ekexiu.console.system.dao;
2
3
import com.ekexiu.console.system.pojo.ConsultInfo;
4
import org.jfw.apt.annotation.Nullable;
5
import org.jfw.apt.orm.annotation.dao.DAO;
6
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
7
import org.jfw.apt.orm.annotation.dao.method.operator.QueryList;
8
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
9
import org.jfw.util.PageQueryResult;
10
11
import java.math.BigDecimal;
12
import java.sql.Connection;
13
import java.sql.PreparedStatement;
14
import java.sql.ResultSet;
15
import java.sql.SQLException;
16
import java.util.ArrayList;
17
import java.util.Collections;
18
import java.util.List;
19
20
/**
21
 * Created by TT on 2017/5/3.
22
 */
23
@DAO
24
public abstract class ConsultDao {
25
26
    @QueryList
27
    @OrderBy("ORDER BY CREATE_TIME DESC")
28
    public abstract List<ConsultInfo> query(Connection con) throws SQLException;
29
30
    public PageQueryResult<ConsultInfo> pageQuery(Connection con, String consultantName, String professorName, String consultTitle, Integer consultStatus, int pageSize, int pageNo) throws SQLException {
31
        int index = 0;
32
        PageQueryResult<ConsultInfo> queryResult = new PageQueryResult<ConsultInfo>();
33
        int paramIndex = 1;
34
        boolean b1 = null == consultStatus;
35
        StringBuilder sql = new StringBuilder();
36
        sql.append(" WHERE consultant_name LIKE ? AND professor_name LIKE ? AND consult_title LIKE ? ");
37
        if (!b1) {
38
            sql.append(" AND consult_status = ?");
39
        }
40
        StringBuilder sbql = sql;
41
        sql = new StringBuilder();
42
        sql.append(" select count(1) from (SELECT p.name as professor_name,o.name as professor_org,pp.name as consultant_name,oo.name as consultant_org,c.CONSULT_ID,c.CONSULT_TYPE,c.CONSULT_TITLE,c.CONSULT_CONTANT,c.PROFESSOR_ID,c.CONSULTANT_ID,c.CONSULT_STATUS,c.FINISH_TIME,c.ASSESS_STATUS,c.ASSESS_STAR,c.ASSESS_CONTANT,c.ASSESS_TIME,c.THANKS_STATUS,c.THANKS_MONEY,c.THANKS_TIME,c.REVOVERY_TIME,c.READ_STATUS,c.DEMAND_ID,c.CREATE_TIME FROM consult c LEFT JOIN professor p on c.professor_id = p.id LEFT JOIN professor pp on c.consultant_id = pp.id LEFT JOIN organization o on o.id = p.org_id LEFT JOIN organization oo on oo.id = pp.org_id ORDER BY CREATE_TIME DESC)as view_consult ");
43
        sql.append(sbql);
44
        PreparedStatement ps = con.prepareStatement(sql.toString());
45
        try {
46
            ps.setString(paramIndex++, consultantName);
47
            ps.setString(paramIndex++, professorName);
48
            ps.setString(paramIndex++, consultTitle);
49
            if (!b1) {
50
                ps.setInt(paramIndex++, consultStatus);
51
            }
52
            queryResult.setPageSize(pageSize);
53
            ResultSet resultSet = ps.executeQuery();
54
            try {
55
                resultSet.next();
56
                index = resultSet.getInt(1);
57
            } finally {
58
                try {
59
                    resultSet.close();
60
                } catch (Exception e) {
61
                }
62
            }
63
        } finally {
64
            try {
65
                ps.close();
66
            } catch (Exception e) {
67
            }
68
        }
69
        queryResult.setTotal(index);
70
        if (0 == index) {
71
            queryResult.setPageNo(1);
72
            queryResult.setData(Collections.<ConsultInfo>emptyList());
73
            return queryResult;
74
        }
75
        paramIndex = 1;
76
        boolean b2 = (1 == pageNo);
77
        if (b2) {
78
            queryResult.setPageNo(1);
79
            sql = new StringBuilder();
80
            sql.append(" WHERE pp.name LIKE ? AND p.name LIKE ? AND c.consult_title LIKE ? ");
81
            if (!b1) {
82
                sql.append(" AND c.consult_status = ?");
83
            }
84
            StringBuilder stringBuilder = sql;
85
            sql = new StringBuilder();
86
            sql.append(" SELECT p.name as professor_name,o.name as professor_Org,pp.name as consultant_Name,oo.name as consultant_Org,c.CONSULT_ID,c.CONSULT_TYPE,c.CONSULT_TITLE,c.CONSULT_CONTANT,c.PROFESSOR_ID,c.CONSULTANT_ID,c.CONSULT_STATUS,c.FINISH_TIME,c.ASSESS_STATUS,c.ASSESS_STAR,c.ASSESS_CONTANT,c.ASSESS_TIME,c.THANKS_STATUS,c.THANKS_MONEY,c.THANKS_TIME,c.REVOVERY_TIME,c.READ_STATUS,c.DEMAND_ID,c.CREATE_TIME FROM consult c LEFT JOIN professor p on c.professor_id = p.id LEFT JOIN professor pp on c.consultant_id = pp.id LEFT JOIN organization o on o.id = p.org_id LEFT JOIN organization oo on oo.id = pp.org_id ");
87
            sql.append(stringBuilder);
88
            sql.append(" ORDER BY CREATE_TIME DESC ");
89
            sql.append(" LIMIT ").append(pageSize);
90
        } else {
91
            int pno = index / pageSize;
92
            if (index % pageSize != 0) {
93
                ++pno;
94
            }
95
            if (pageNo > pno) {
96
                pageNo = pno;
97
            }
98
            queryResult.setPageNo(pageNo);
99
            --pageNo;
100
            int offset = (pageNo * pageSize);
101
            sql = new StringBuilder();
102
            sql.append(" WHERE pp.name LIKE ? AND p.name LIKE ? AND c.consult_title LIKE ? ");
103
            if (!b1) {
104
                sql.append(" AND c.consult_status = ?");
105
            }
106
            StringBuilder stringBuilder = sql;
107
            sql = new StringBuilder();
108
            sql.append(" SELECT p.name as professor_name,o.name as professor_Org,pp.name as consultant_Name,oo.name as consultant_Org,c.CONSULT_ID,c.CONSULT_TYPE,c.CONSULT_TITLE,c.CONSULT_CONTANT,c.PROFESSOR_ID,c.CONSULTANT_ID,c.CONSULT_STATUS,c.FINISH_TIME,c.ASSESS_STATUS,c.ASSESS_STAR,c.ASSESS_CONTANT,c.ASSESS_TIME,c.THANKS_STATUS,c.THANKS_MONEY,c.THANKS_TIME,c.REVOVERY_TIME,c.READ_STATUS,c.DEMAND_ID,c.CREATE_TIME FROM consult c LEFT JOIN professor p on c.professor_id = p.id LEFT JOIN professor pp on c.consultant_id = pp.id LEFT JOIN organization o on o.id = p.org_id LEFT JOIN organization oo on oo.id = pp.org_id ");
109
            sql.append(stringBuilder);
110
            sql.append(" ORDER BY CREATE_TIME DESC ");
111
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(offset);
112
        }
113
        ps = con.prepareStatement(sql.toString());
114
        try {
115
            ps.setString(paramIndex++, consultantName);
116
            ps.setString(paramIndex++, professorName);
117
            ps.setString(paramIndex++, consultTitle);
118
            if (!b1) {
119
                ps.setInt(paramIndex++, consultStatus);
120
            }
121
            ResultSet rs = ps.executeQuery();
122
            try {
123
                List<ConsultInfo> consultInfos = new ArrayList<ConsultInfo>();
124
                queryResult.setData(consultInfos);
125
                int indx = 0;
126
                while ((indx < pageSize) && rs.next()) {
127
                    ++indx;
128
                    ConsultInfo consultInfo = new ConsultInfo();
129
                    String pName = rs.getString(1);
130
                    if (rs.wasNull()) {
131
                        pName = null;
132
                    }
133
                    consultInfo.setProfessorName(pName);
134
                    String pOrg = rs.getString(2);
135
                    if (rs.wasNull()) {
136
                        pOrg = null;
137
                    }
138
                    consultInfo.setProfessorOrg(pOrg);
139
                    String cName = rs.getString(3);
140
                    if (rs.wasNull()) {
141
                        cName = null;
142
                    }
143
                    consultInfo.setConsultantName(cName);
144
                    String cOrg = rs.getString(4);
145
                    if (rs.wasNull()) {
146
                        cOrg = null;
147
                    }
148
                    consultInfo.setConsultantOrg(cOrg);
149
                    String cId = rs.getString(5);
150
                    if (rs.wasNull()) {
151
                        cId = null;
152
                    }
153
                    consultInfo.setConsultId(cId);
154
                    String consultType = rs.getString(6);
155
                    if (rs.wasNull()) {
156
                        consultType = null;
157
                    }
158
                    consultInfo.setConsultType(consultType);
159
                    String cTitle = rs.getString(7);
160
                    if (rs.wasNull()) {
161
                        cTitle = null;
162
                    }
163
                    consultInfo.setConsultTitle(cTitle);
164
                    String consultContant = rs.getString(8);
165
                    if (rs.wasNull()) {
166
                        consultContant = null;
167
                    }
168
                    consultInfo.setConsultContant(consultContant);
169
                    String pId = rs.getString(9);
170
                    if (rs.wasNull()) {
171
                        pId = null;
172
                    }
173
                    consultInfo.setProfessorId(pId);
174
                    String consultantId = rs.getString(10);
175
                    if (rs.wasNull()) {
176
                        consultantId = null;
177
                    }
178
                    consultInfo.setConsultantId(consultantId);
179
                    Integer cStatus = rs.getInt(11);
180
                    if (rs.wasNull()) {
181
                        cStatus = null;
182
                    }
183
                    consultInfo.setConsultStatus(cStatus);
184
                    String finishTime = rs.getString(12);
185
                    if (rs.wasNull()) {
186
                        finishTime = null;
187
                    }
188
                    consultInfo.setFinishTime(finishTime);
189
                    Integer assessStatus = rs.getInt(13);
190
                    if (rs.wasNull()) {
191
                        assessStatus = null;
192
                    }
193
                    consultInfo.setAssessStatus(assessStatus);
194
                    Integer assessStar = rs.getInt(14);
195
                    if (rs.wasNull()) {
196
                        assessStar = null;
197
                    }
198
                    consultInfo.setAssessStar(assessStar);
199
                    String assessContant = rs.getString(15);
200
                    if (rs.wasNull()) {
201
                        assessContant = null;
202
                    }
203
                    consultInfo.setAssessContant(assessContant);
204
                    String assessTime = rs.getString(16);
205
                    if (rs.wasNull()) {
206
                        assessTime = null;
207
                    }
208
                    consultInfo.setAssessTime(assessTime);
209
                    Integer thanksStatus = rs.getInt(17);
210
                    if (rs.wasNull()) {
211
                        thanksStatus = null;
212
                    }
213
                    consultInfo.setThanksStatus(thanksStatus);
214
                    BigDecimal thanksMoney = rs.getBigDecimal(18);
215
                    if (rs.wasNull()) {
216
                        thanksMoney = null;
217
                    }
218
                    consultInfo.setThanksMoney(thanksMoney);
219
                    String thanksTime = rs.getString(19);
220
                    if (rs.wasNull()) {
221
                        thanksTime = null;
222
                    }
223
                    consultInfo.setThanksTime(thanksTime);
224
                    consultInfo.setRevoveryTime(rs.getString(20));
225
                    consultInfo.setReadStatus(rs.getInt(21));
226
                    String demandId = rs.getString(22);
227
                    if (rs.wasNull()) {
228
                        demandId = null;
229
                    }
230
                    consultInfo.setDemandId(demandId);
231
                    consultInfo.setCreateTime(rs.getString(23));
232
                    consultInfos.add(consultInfo);
233
                }
234
                return queryResult;
235
            } finally {
236
                try {
237
                    rs.close();
238
                } catch (Exception e) {
239
                }
240
            }
241
        } finally {
242
            try {
243
                ps.close();
244
            } catch (Exception e) {
245
            }
246
        }
247
    }
248
249
    @Nullable
250
    @QueryOne
251
    public abstract ConsultInfo query(Connection con, String consultId) throws SQLException;
252
}

+ 202 - 0
src/main/java/com/ekexiu/console/system/po/Consult.java

@ -0,0 +1,202 @@
1
package com.ekexiu.console.system.po;
2
3
import com.ekexiu.console.basepo.CreateTimeSupported;
4
import org.jfw.apt.orm.annotation.entry.Column;
5
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
6
import org.jfw.apt.orm.annotation.entry.Table;
7
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
8
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
9
import org.jfw.apt.orm.core.defaultImpl.WIntHandler;
10
import org.jfw.apt.orm.core.enums.DE;
11
12
import java.math.BigDecimal;
13
import java.util.List;
14
15
/**
16
 * Created by TT on 2017/5/3.
17
 */
18
@PrimaryKey("consultId")
19
@Table
20
public class Consult implements CreateTimeSupported {
21
    private String consultId;
22
    private String consultType;
23
    private String consultTitle;
24
    private String consultContant;
25
    private String createTime;
26
    private String professorId;
27
    private String consultantId;
28
    private Integer consultStatus;
29
    private String finishTime;
30
    private Integer assessStatus;
31
    private Integer assessStar;
32
    private String assessContant;
33
    private String assessTime;
34
    private Integer thanksStatus;
35
    private BigDecimal thanksMoney;
36
    private String thanksTime;
37
    private String revoveryTime;
38
    private Integer readStatus;
39
    private String demandId;
40
    private List<Tidings> tidings;
41
42
    public List<Tidings> getTidings() {
43
        return tidings;
44
    }
45
    public void setTidings(List<Tidings> tidings) {
46
        this.tidings = tidings;
47
    }
48
49
    @Column(DE.id_32)
50
    public String getConsultId() {
51
        return consultId;
52
    }
53
    public void setConsultId(String consultId) {
54
        this.consultId = consultId;
55
    }
56
57
    @Column(DE.string_de)
58
    public String getConsultType() {
59
        return consultType;
60
    }
61
    public void setConsultType(String consultType) {
62
        this.consultType = consultType;
63
    }
64
65
    @Column(DE.string_de)
66
    public String getConsultTitle() {
67
        return consultTitle;
68
    }
69
    public void setConsultTitle(String consultTitle) {
70
        this.consultTitle = consultTitle;
71
    }
72
73
    @Column(handlerClass=StringHandler.class,dbType="TEXT",nullable=false,insertable=true,renewable=false,queryable=true)
74
    public String getConsultContant() {
75
        return consultContant;
76
    }
77
    public void setConsultContant(String consultContant) {
78
        this.consultContant = consultContant;
79
    }
80
81
82
    public String getCreateTime() {
83
        return createTime;
84
    }
85
    public void setCreateTime(String createTime) {
86
        this.createTime = createTime;
87
    }
88
89
    @Column(DE.id_32)
90
    public String getProfessorId() {
91
        return professorId;
92
    }
93
    public void setProfessorId(String professorId) {
94
        this.professorId = professorId;
95
    }
96
97
    @Column(DE.id_32)
98
    public String getConsultantId() {
99
        return consultantId;
100
    }
101
    public void setConsultantId(String consultantId) {
102
        this.consultantId = consultantId;
103
    }
104
105
    @Column(handlerClass=WIntHandler.class,dbType="INT",nullable=true,insertable=true,renewable=true,queryable=true)
106
    public Integer getConsultStatus() {
107
        return consultStatus;
108
    }
109
    public void setConsultStatus(Integer consultStatus) {
110
        this.consultStatus = consultStatus;
111
    }
112
113
    @Column(handlerClass = FixLenStringHandler.class, dbType = "CHAR(14)", insertable = false, nullable = true, queryable = true, renewable = true)
114
    public String getFinishTime() {
115
        return finishTime;
116
    }
117
    public void setFinishTime(String finishTime) {
118
        this.finishTime = finishTime;
119
    }
120
121
    @Column(handlerClass=WIntHandler.class,dbType="INT",nullable=true,insertable=true,renewable=true,queryable=true)
122
    public Integer getAssessStatus() {
123
        return assessStatus;
124
    }
125
    public void setAssessStatus(Integer assessStatus) {
126
        this.assessStatus = assessStatus;
127
    }
128
129
    @Column(handlerClass=WIntHandler.class,dbType="INT",nullable=true,insertable=false,renewable=true,queryable=true)
130
    public Integer getAssessStar() {
131
        return assessStar;
132
    }
133
    public void setAssessStar(Integer assessStar) {
134
        this.assessStar = assessStar;
135
    }
136
137
    @Column(handlerClass=StringHandler.class,dbType="TEXT",nullable=true,insertable=false,renewable=true,queryable=true)
138
    public String getAssessContant() {
139
        return assessContant;
140
    }
141
    public void setAssessContant(String assessContant) {
142
        this.assessContant = assessContant;
143
    }
144
145
    @Column(handlerClass = FixLenStringHandler.class, dbType = "CHAR(14)", insertable = false, nullable = true, queryable = true, renewable = true)
146
    public String getAssessTime() {
147
        return assessTime;
148
    }
149
    public void setAssessTime(String assessTime) {
150
        this.assessTime = assessTime;
151
    }
152
153
    @Column(handlerClass=WIntHandler.class,dbType="INT",nullable=true,insertable=true,renewable=true,queryable=true)
154
    public Integer getThanksStatus() {
155
        return thanksStatus;
156
    }
157
    public void setThanksStatus(Integer thanksStatus) {
158
        this.thanksStatus = thanksStatus;
159
    }
160
161
    @Column(DE.BigDecmimal_de)
162
    public BigDecimal getThanksMoney() {
163
        return thanksMoney;
164
    }
165
    public void setThanksMoney(BigDecimal thanksMoney) {
166
        this.thanksMoney = thanksMoney;
167
    }
168
169
    @Column(handlerClass=FixLenStringHandler.class,dbType="CHAR(14)",insertable=false,nullable=true,queryable=true,renewable=true)
170
    public String getThanksTime() {
171
        return thanksTime;
172
    }
173
    public void setThanksTime(String thanksTime) {
174
        this.thanksTime = thanksTime;
175
    }
176
177
    @Column(handlerClass=FixLenStringHandler.class,dbType="CHAR(14)",fixSqlValueWithInsert="TO_CHAR(NOW(),'YYYYMMDDHH24MISS')",
178
            fixSqlValueWithUpdate="TO_CHAR(NOW(),'YYYYMMDDHH24MISS')",insertable=true,nullable=true,queryable=true,renewable=true)
179
    public String getRevoveryTime() {
180
        return revoveryTime;
181
    }
182
    public void setRevoveryTime(String revoveryTime) {
183
        this.revoveryTime = revoveryTime;
184
    }
185
186
    @Column(handlerClass=WIntHandler.class,dbType="INT",nullable=false,insertable=true,renewable=true,queryable=true)
187
    public Integer getReadStatus() {
188
        return readStatus;
189
    }
190
    public void setReadStatus(Integer readStatus) {
191
        this.readStatus = readStatus;
192
    }
193
194
    @Column(value= DE.id_32,nullable=true)
195
    public String getDemandId() {
196
        return demandId;
197
    }
198
    public void setDemandId(String demandId) {
199
        this.demandId = demandId;
200
    }
201
202
}

+ 93 - 0
src/main/java/com/ekexiu/console/system/pojo/ConsultInfo.java

@ -0,0 +1,93 @@
1
package com.ekexiu.console.system.pojo;
2
3
import com.ekexiu.console.system.po.Consult;
4
import org.jfw.apt.orm.annotation.entry.CalcColumn;
5
import org.jfw.apt.orm.annotation.entry.ExtendView;
6
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
7
8
/**
9
 * Created by TT on 2017/5/3.
10
 */
11
@ExtendView(fromSentence = "consult c LEFT JOIN professor p on c.professor_id = p.id LEFT JOIN professor pp on c.consultant_id = pp.id LEFT JOIN organization o on o.id = p.org_id LEFT JOIN organization oo on oo.id = pp.org_id ", tableAlias = "c")
12
public class ConsultInfo extends Consult {
13
    private String professorName;
14
    private String professorOrg;
15
    private String professorPhone;
16
    private String professorEmail;
17
    private String consultantName;
18
    private String consultantOrg;
19
    private String consultantPhone;
20
    private String consultantEmail;
21
22
    @CalcColumn(handlerClass = StringHandler.class,column = "p.phone")
23
    public String getProfessorPhone() {
24
        return professorPhone;
25
    }
26
27
    public void setProfessorPhone(String professorPhone) {
28
        this.professorPhone = professorPhone;
29
    }
30
31
    @CalcColumn(handlerClass = StringHandler.class,column = "p.email")
32
    public String getProfessorEmail() {
33
        return professorEmail;
34
    }
35
36
    public void setProfessorEmail(String professorEmail) {
37
        this.professorEmail = professorEmail;
38
    }
39
40
    @CalcColumn(handlerClass = StringHandler.class,column = "pp.phone")
41
    public String getConsultantPhone() {
42
        return consultantPhone;
43
    }
44
45
    public void setConsultantPhone(String consultantPhone) {
46
        this.consultantPhone = consultantPhone;
47
    }
48
49
    @CalcColumn(handlerClass = StringHandler.class,column = "pp.email")
50
    public String getConsultantEmail() {
51
        return consultantEmail;
52
    }
53
54
    public void setConsultantEmail(String consultantEmail) {
55
        this.consultantEmail = consultantEmail;
56
    }
57
58
    @CalcColumn(handlerClass = StringHandler.class,column = "p.name")
59
    public String getProfessorName() {
60
        return professorName;
61
    }
62
63
    public void setProfessorName(String professorName) {
64
        this.professorName = professorName;
65
    }
66
67
    @CalcColumn(handlerClass = StringHandler.class,column = "o.name")
68
    public String getProfessorOrg() {
69
        return professorOrg;
70
    }
71
72
    public void setProfessorOrg(String professorOrg) {
73
        this.professorOrg = professorOrg;
74
    }
75
76
    @CalcColumn(handlerClass = StringHandler.class,column = "pp.name")
77
    public String getConsultantName() {
78
        return consultantName;
79
    }
80
81
    public void setConsultantName(String consultantName) {
82
        this.consultantName = consultantName;
83
    }
84
85
    @CalcColumn(handlerClass = StringHandler.class,column = "oo.name")
86
    public String getConsultantOrg() {
87
        return consultantOrg;
88
    }
89
90
    public void setConsultantOrg(String consultantOrg) {
91
        this.consultantOrg = consultantOrg;
92
    }
93
}

+ 73 - 0
src/main/java/com/ekexiu/console/system/service/ConsultService.java

@ -0,0 +1,73 @@
1
package com.ekexiu.console.system.service;
2
3
import com.ekexiu.console.system.dao.ConsultDao;
4
import com.ekexiu.console.system.dao.TidingsDao;
5
import com.ekexiu.console.system.pojo.ConsultInfo;
6
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.annotation.DefaultValue;
8
import org.jfw.apt.annotation.Nullable;
9
import org.jfw.apt.orm.annotation.dao.param.Like;
10
import org.jfw.apt.web.annotation.Path;
11
import org.jfw.apt.web.annotation.operate.Get;
12
import org.jfw.apt.web.annotation.param.JdbcConn;
13
import org.jfw.apt.web.annotation.param.PathVar;
14
import org.jfw.util.PageQueryResult;
15
16
import java.sql.Connection;
17
import java.sql.SQLException;
18
19
/**
20
 * Created by TT on 2017/5/3.
21
 */
22
@Path("/consult")
23
public class ConsultService {
24
    @Autowrie
25
    private ConsultDao consultDao;
26
27
    @Autowrie
28
    private TidingsDao tidingsDao;
29
30
    public TidingsDao getTidingsDao() {
31
        return tidingsDao;
32
    }
33
34
    public void setTidingsDao(TidingsDao tidingsDao) {
35
        this.tidingsDao = tidingsDao;
36
    }
37
38
    public ConsultDao getConsultDao() {
39
        return consultDao;
40
    }
41
42
    public void setConsultDao(ConsultDao consultDao) {
43
        this.consultDao = consultDao;
44
    }
45
46
    @Get
47
    @Path("/qa")
48
    public PageQueryResult<ConsultInfo> query(@JdbcConn Connection con, @Nullable @Like String consultantName, @Nullable @Like String professorName, @Nullable @Like String consultTitle, @Nullable @Like Integer consultStatus, @DefaultValue("1") int pageSize, @DefaultValue("10") int pageNo) throws SQLException {
49
        String cName ="%";
50
        if(consultantName!=null)
51
        {
52
            cName="%"+consultantName+"%";
53
        }
54
        String pName ="%";
55
        if(professorName!=null)
56
        {
57
            pName="%"+professorName+"%";
58
        }
59
        String cTitle ="%";
60
        if(consultTitle!=null)
61
        {
62
            cTitle="%"+consultTitle+"%";
63
        }
64
        return this.consultDao.pageQuery(con,cName,pName,cTitle,consultStatus,pageSize,pageNo);
65
    }
66
67
    @Get
68
    @Path("/id/{id}")
69
    public ConsultInfo query(@JdbcConn Connection con, @PathVar String id)throws SQLException {
70
        return this.consultDao.query(con, id);
71
    }
72
73
}