jiapeng vor 7 Jahren
Ursprung
Commit
59bef0f0ac

+ 6 - 0
src/main/java/com/ekexiu/portal/question/QuestionDao.java

@ -100,4 +100,10 @@ public interface QuestionDao {
100 100
	@From(Answer.class)
101 101
	@IncludeFixSet
102 102
	int updateAnswer(Connection con, String id, @Set String cnt) throws SQLException;
103
	
104
	@Insert
105
	int insert(Connection con,QuestionInviteRec rec)throws SQLException;
106
	
107
	@SelectList
108
	List<QuestionInviteRec> queryInviteRec(Connection con,String qid,String uid,@In String[] pid)throws SQLException;
103 109
}

+ 46 - 0
src/main/java/com/ekexiu/portal/question/QuestionInviteRec.java

@ -0,0 +1,46 @@
1
package com.ekexiu.portal.question;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7

8
import com.ekexiu.portal.basepo.CreateTimeSupported;
9

10
@PrimaryKey({"uid","qid","pid"})
11
@Table
12
public class QuestionInviteRec implements CreateTimeSupported {
13

14
	private String uid;
15
	private String qid;
16
	private String pid;
17
	private String createTime;
18
	@Column(DE.text_de)
19
	public String getUid() {
20
		return uid;
21
	}
22
	public void setUid(String uid) {
23
		this.uid = uid;
24
	}
25
	@Column(DE.text_de)
26
	public String getQid() {
27
		return qid;
28
	}
29
	public void setQid(String qid) {
30
		this.qid = qid;
31
	}
32
	@Column(DE.text_de)
33
	public String getPid() {
34
		return pid;
35
	}
36
	public void setPid(String pid) {
37
		this.pid = pid;
38
	}
39
	public String getCreateTime() {
40
		return createTime;
41
	}
42
	public void setCreateTime(String createTime) {
43
		this.createTime = createTime;
44
	}
45
	
46
}

+ 20 - 0
src/main/java/com/ekexiu/portal/question/Service.java

@ -209,9 +209,29 @@ public class Service {
209 209
		if (q == null) {
210 210
			throw new JfwBaseException(50000, "question[" +qid + "] not found");
211 211
		}
212
		QuestionInviteRec rec = new QuestionInviteRec();
213
		rec.setUid(uid);
214
		rec.setPid(pid);
215
		rec.setQid(qid);
216
		try{
217
			questionDao.insert(con,rec);
218
		}catch(SQLException e){
219
			if(SqlUtil.unique(e)){
220
				throw new JfwBaseException(50001, "duplicate invite");
221
			}
222
			throw e;
223
		}
224
		
225
		
212 226
		this.notifyService.notify(con, pid, uid, uname, qid, q.getTitle(), NotifyType.INVITE_ANSWER, runs);
213 227
		return true;
214 228
	}
229
	
230
	@Get
231
	@Path("/invite")
232
	public List<QuestionInviteRec> queryInviteRec(@JdbcConn Connection con,String uid,String qid,String[] pid)throws SQLException{
233
		return questionDao.queryInviteRec(con, qid, uid, pid);
234
	}
215 235

216 236
	/**
217 237
	 * 回答一个提问

+ 6 - 0
src/main/resources/database.sql

@ -2185,4 +2185,10 @@ COMMENT ON COLUMN NOTIFY_MSG_CNT.PID is '参数ID';
2185 2185
COMMENT ON COLUMN NOTIFY_MSG_CNT.UID is '通知触发人ID';
2186 2186
COMMENT ON COLUMN NOTIFY_MSG_CNT.UID is '通知类型(详见文档)';
2187 2187

2188
CREATE TABLE QUESTION_INVITE_REC (UID TEXT NOT NULL,QID TEXT NOT NULL,PID TEXT NOT NULL,CREATE_TIME CHAR(14) NOT NULL);
2189
ALTER TABLE QUESTION_INVITE_REC ADD PRIMARY KEY (UID,QID,PID);
2190
COMMENT ON TABLE QUESTION_INVITE_REC is '邀请记录表';
2191
COMMENT ON COLUMN QUESTION_INVITE_REC.UID is '邀请人ID';
2192
COMMENT ON COLUMN QUESTION_INVITE_REC.PID is '被邀请人ID';
2193
COMMENT ON COLUMN QUESTION_INVITE_REC.QID is '提问ID';
2188 2194