jiapeng 6 years ago
parent
commit
dce0f3473b

+ 68 - 193
src/main/java/com/ekexiu/portal/dao/ArticleDao.java

@ -54,11 +54,11 @@ public abstract class ArticleDao {
54 54
	public abstract int update(Connection con, Article article) throws SQLException;
55 55

56 56
	@Insert
57
	public abstract int insert(Connection con,ArticleWare ware)throws SQLException;
57
	public abstract int insert(Connection con, ArticleWare ware) throws SQLException;
58 58

59 59
	@DeleteWith
60 60
	@From(ArticleWare.class)
61
	public abstract int deleteWare(Connection con,String id)throws SQLException;
61
	public abstract int deleteWare(Connection con, String id) throws SQLException;
62 62

63 63
	@UpdateWith
64 64
	@From(Article.class)
@ -122,23 +122,61 @@ public abstract class ArticleDao {
122 122
	@Where("STATUS = '1' AND ARTICLE_TYPE = '1'")
123 123
	public abstract PageQueryResult<Article> pageQueryProPublish(Connection con, String ownerId, int pageSize, int pageNo) throws SQLException;
124 124

125
	//@LimitSelect
126
	//@Exclude("articleContent")
127
	//@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
128
	//@Where("STATUS = '1'")
129
	//public abstract List<Article> proPublish(Connection con, String professorId, String publishTime, long shareId, int rows)throws SQLException;
130
    //
131
	//@LimitSelect
132
	//@Exclude("articleContent")
133
	//@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
134
	//@Where("STATUS = '1'")
135
	//public abstract List<Article> orgPublish(Connection con, String orgId, String publishTime, long shareId, int rows)throws SQLException;
125
	// @LimitSelect
126
	// @Exclude("articleContent")
127
	// @OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false),
128
	// @LimitColumn(value = "shareId",asc = false, handlerClass =
129
	// LongHandler.class)}, value = "")
130
	// @Where("STATUS = '1'")
131
	// public abstract List<Article> proPublish(Connection con, String
132
	// professorId, String publishTime, long shareId, int rows)throws
133
	// SQLException;
134
	//
135
	// @LimitSelect
136
	// @Exclude("articleContent")
137
	// @OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false),
138
	// @LimitColumn(value = "shareId",asc = false, handlerClass =
139
	// LongHandler.class)}, value = "")
140
	// @Where("STATUS = '1'")
141
	// public abstract List<Article> orgPublish(Connection con, String orgId,
142
	// String publishTime, long shareId, int rows)throws SQLException;
143

144
	@LimitSelect
145
	@Exclude("articleContent")
146
	@OrderBy(cols = { @LimitColumn(value = "publishTime", asc = false),
147
			@LimitColumn(value = "shareId", asc = false, handlerClass = LongHandler.class) }, value = "")
148
	@Where("STATUS = '1'")
149
	public abstract List<Article> publish(Connection con, String articleType, String ownerId, String publishTime, long shareId, int rows) throws SQLException;
136 150

137 151
	@LimitSelect
138 152
	@Exclude("articleContent")
139
	@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
153
	@OrderBy(cols = { @LimitColumn(value = "publishTime", asc = false),
154
			@LimitColumn(value = "shareId", asc = false, handlerClass = LongHandler.class) }, value = "")
155
	@Where("STATUS = '1'")
156
	public abstract List<Article> publishInPlatform(Connection con,
157
			@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT AID FROM REFERENCED_ARTICLE WHERE PID=?" }) String pid,
158
			String publishTime, long shareId, int rows) throws SQLException;
159

160
	@PageSelect
161
	@Exclude("articleContent")
162
	@OrderBy(value = "ORDER BY PUBLISH_TIME DESC")
163
	@Where("STATUS = '1'")
164
	public abstract PageQueryResult<Article> publishInPlatform(Connection con,
165
			@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT AID FROM REFERENCED_ARTICLE WHERE PID=?" }) String pid,
166
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_TITLE LIKE ?",
167
					"OWNER_ID IN (SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE)" }, additional = 1, isAnd = false) String key,
168
			int pageSize, int pageNo) throws SQLException;
169

170
	@PageSelect
171
	@Exclude("articleContent")
172
	@OrderBy(value = "ORDER BY PUBLISH_TIME DESC")
140 173
	@Where("STATUS = '1'")
141
	public abstract List<Article> publish(Connection con,String articleType, String ownerId, String publishTime, long shareId, int rows)throws SQLException;
174
	public abstract PageQueryResult<Article> publishNotInPlatform(Connection con,
175
			@GroupSqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID NOT IN (SELECT AID FROM REFERENCED_ARTICLE WHERE PID=?",
176
					"ARTICLE_TYPE='2' AND OWNER_ID IN (SELECT OID FROM RESIDENT_ORG WHERE PID=?)" }, isAnd = true) String pid,
177
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_TITLE LIKE ?",
178
					"OWNER_ID IN (SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE)" }, additional = 1, isAnd = false) String key,
179
			int pageSize, int pageNo) throws SQLException;
142 180

143 181
	@Exclude("articleContent")
144 182
	@SelectList
@ -175,178 +213,7 @@ public abstract class ArticleDao {
175 213
	public abstract Article queryOne(Connection con, String articleId) throws SQLException;
176 214

177 215
	@SelectList
178
	public abstract List<ArticleWare> queryWares(Connection con,String id)throws SQLException;
179

180
	public List<Article> queryByPageViews(Connection con, String articleId, int rows) throws SQLException {
181
		int index = 1;
182
		boolean hasArticleId = null != articleId;
183
		StringBuilder sql = new StringBuilder();
184
		sql.append(
185
				"SELECT ARTICLE_ID,OWNER_ID,ARTICLE_TITLE,'',SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE");
186
		sql.append(" WHERE STATUS = '1'");
187
		if (hasArticleId) {
188
			sql.append(" AND ARTICLE_ID != ?");
189
		}
190
		sql.append(" ORDER BY PAGE_VIEWS DESC");
191
		sql.append(" LIMIT ").append(rows);
192
		PreparedStatement ps = con.prepareStatement(sql.toString());
193
		try {
194
			if (hasArticleId) {
195
				ps.setString(index++, articleId);
196
			}
197
			ResultSet rs = ps.executeQuery();
198
			try {
199
				List<Article> articles = new ArrayList<Article>();
200
				while (rs.next()) {
201
					Article article = new Article();
202
					article.setArticleId(rs.getString(1));
203
					String proId = rs.getString(2);
204
					if (rs.wasNull()) {
205
						proId = null;
206
					}
207
					article.setOwnerId(proId);
208
					article.setArticleTitle(rs.getString(3));
209
					String articleContent = rs.getString(4);
210
					if (rs.wasNull()) {
211
						articleContent = null;
212
					}
213
					article.setArticleContent(articleContent);
214
					String subject = rs.getString(5);
215
					if (rs.wasNull()) {
216
						subject = null;
217
					}
218
					article.setSubject(subject);
219
					String publishTime = rs.getString(6);
220
					if (rs.wasNull()) {
221
						publishTime = null;
222
					}
223
					article.setPublishTime(publishTime);
224
					String articleImg = rs.getString(7);
225
					if (rs.wasNull()) {
226
						articleImg = null;
227
					}
228
					article.setArticleImg(articleImg);
229
					String articleType = rs.getString(8);
230
					if (rs.wasNull()) {
231
						articleType = null;
232
					}
233
					article.setArticleType(articleType);
234
					article.setArticleAgree(rs.getInt(9));
235
					article.setPageViews(rs.getInt(10));
236
					String status = rs.getString(11);
237
					if (rs.wasNull()) {
238
						status = null;
239
					}
240
					article.setStatus(status);
241
					article.setCreateTime(rs.getString(12));
242
					article.setModifyTime(rs.getString(13));
243
					article.setShareId(rs.getLong(14));
244
					article.setColNum(rs.getInt(15));
245
					articles.add(article);
246
				}
247
				return articles;
248
			} finally {
249
				try {
250
					rs.close();
251
				} catch (Exception e1) {
252
				}
253
			}
254
		} finally {
255
			try {
256
				ps.close();
257
			} catch (Exception e2) {
258
			}
259
		}
260
	}
261

262
	public List<Article> queryByAuthor(Connection con, String ownerId, String articleId, int rows) throws SQLException {
263
		int index = 1;
264
		boolean hasOwnerId = null != ownerId;
265
		boolean hasArticleId = null != articleId;
266
		StringBuilder sql = new StringBuilder();
267
		sql.append(
268
				"SELECT ARTICLE_ID,OWNER_ID,ARTICLE_TITLE,'',SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE");
269
		sql.append(" WHERE STATUS = '1'");
270
		if (hasOwnerId) {
271
			sql.append(" AND OWNER_ID = ?");
272
		}
273
		if (hasArticleId) {
274
			sql.append(" AND ARTICLE_ID != ?");
275
		}
276
		sql.append(" ORDER BY PUBLISH_TIME DESC");
277
		sql.append(" LIMIT ").append(rows);
278
		PreparedStatement ps = con.prepareStatement(sql.toString());
279
		try {
280
			if (hasOwnerId) {
281
				ps.setString(index++, ownerId);
282
			}
283
			if (hasArticleId) {
284
				ps.setString(index++, articleId);
285
			}
286
			ResultSet rs = ps.executeQuery();
287
			try {
288
				List<Article> articles = new ArrayList<Article>();
289
				while (rs.next()) {
290
					Article article = new Article();
291
					article.setArticleId(rs.getString(1));
292
					String proId = rs.getString(2);
293
					if (rs.wasNull()) {
294
						proId = null;
295
					}
296
					article.setOwnerId(proId);
297
					article.setArticleTitle(rs.getString(3));
298
					String articleContent = rs.getString(4);
299
					if (rs.wasNull()) {
300
						articleContent = null;
301
					}
302
					article.setArticleContent(articleContent);
303
					String subject = rs.getString(5);
304
					if (rs.wasNull()) {
305
						subject = null;
306
					}
307
					article.setSubject(subject);
308
					String publishTime = rs.getString(6);
309
					if (rs.wasNull()) {
310
						publishTime = null;
311
					}
312
					article.setPublishTime(publishTime);
313
					String articleImg = rs.getString(7);
314
					if (rs.wasNull()) {
315
						articleImg = null;
316
					}
317
					article.setArticleImg(articleImg);
318
					String articleType = rs.getString(8);
319
					if (rs.wasNull()) {
320
						articleType = null;
321
					}
322
					article.setArticleType(articleType);
323
					article.setArticleAgree(rs.getInt(9));
324
					article.setPageViews(rs.getInt(10));
325
					String status = rs.getString(11);
326
					if (rs.wasNull()) {
327
						status = null;
328
					}
329
					article.setStatus(status);
330
					article.setCreateTime(rs.getString(12));
331
					article.setModifyTime(rs.getString(13));
332
					article.setShareId(rs.getLong(14));
333
					article.setColNum(rs.getInt(15));
334
					articles.add(article);
335
				}
336
				return articles;
337
			} finally {
338
				try {
339
					rs.close();
340
				} catch (Exception e1) {
341
				}
342
			}
343
		} finally {
344
			try {
345
				ps.close();
346
			} catch (Exception e2) {
347
			}
348
		}
349
	}
216
	public abstract List<ArticleWare> queryWares(Connection con, String id) throws SQLException;
350 217

351 218
	public String[] queryArticleIdWithSameKeyWord(Connection con, String id, int rows) throws SQLException {
352 219
		List<String> ret = new ArrayList<String>();
@ -505,8 +372,13 @@ public abstract class ArticleDao {
505 372
	@LimitSelect
506 373
	@Exclude("articleContent")
507 374
	@Where("STATUS = '1'")
508
	@OrderBy(cols = {@LimitColumn(value = "sortNum", asc = false, handlerClass = LongHandler.class), @LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "articleId", asc = false)}, value = "")
509
	public abstract List<Article> indexSearch(Connection con,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {"OWNER_ID IN (SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)", "OWNER_ID IN (SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)", "ARTICLE_TITLE LIKE ?", "SUBJECT LIKE ?"}, additional = 1, isAnd = false) String key, long sortNum, String publishTime, String articleId, int rows) throws SQLException;
375
	@OrderBy(cols = { @LimitColumn(value = "sortNum", asc = false, handlerClass = LongHandler.class), @LimitColumn(value = "publishTime", asc = false),
376
			@LimitColumn(value = "articleId", asc = false) }, value = "")
377
	public abstract List<Article> indexSearch(Connection con,
378
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "OWNER_ID IN (SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
379
					"OWNER_ID IN (SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)", "ARTICLE_TITLE LIKE ?",
380
					"SUBJECT LIKE ?" }, additional = 1, isAnd = false) String key,
381
			long sortNum, String publishTime, String articleId, int rows) throws SQLException;
510 382

511 383
	// public PageQueryResult<Article> firstPageQuery(Connection con, String
512 384
	// key, int pageSize, int pageNo) throws SQLException {
@ -682,8 +554,9 @@ public abstract class ArticleDao {
682 554
	@Exclude("articleContent")
683 555
	@OrderBy(" ORDER BY selfOrderField DESC,SHARE_ID ASC ")
684 556
	@Where("STATUS IN ('1','0','2')")
685
	public abstract PageQueryResult<SelfArticle> queryPageForSelf(Connection con, @Nullable String ownerId,
686
			@Like @Nullable String articleTitle, int pageSize, int pageNo) throws SQLException;
557
	public abstract PageQueryResult<SelfArticle> queryPageForSelf(Connection con, String articleType, String ownerId,
558
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_TITLE LIKE ?", "SUBJECT LIKE ?" }, isAnd = false) String key,
559
			int pageSize, int pageNo) throws SQLException;
687 560

688 561
	public PageQueryResult<FindInfo> queryPage(Connection con, int pageSize, int pageNo) throws SQLException {
689 562
		int total = 0;
@ -891,8 +764,10 @@ public abstract class ArticleDao {
891 764
	public abstract List<Article> lasterByPublishTime(Connection con, @GtEq String publishTime, int rows) throws SQLException;
892 765

893 766
	@LimitSelect
894
	@OrderBy( " ORDER BY PAGE_VIEWS DESC")
895
	public abstract List<Article> queryByWareId(Connection con,@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT ID FROM ARTICLE_WARE WHERE WARE =?)" }) String ware,int rows) throws SQLException;
767
	@OrderBy(" ORDER BY PAGE_VIEWS DESC")
768
	public abstract List<Article> queryByWareId(Connection con,
769
			@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT ID FROM ARTICLE_WARE WHERE WARE =?)" }) String ware, int rows)
770
			throws SQLException;
896 771

897 772
	@DefaultValue("0")
898 773
	@QueryVal

+ 30 - 0
src/main/java/com/ekexiu/portal/platform/ButtedOrgInfo.java

@ -0,0 +1,30 @@
1
package com.ekexiu.portal.platform;
2

3
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
6

7
import com.ekexiu.portal.po.Organization;
8

9
@ExtendView(fromSentence="ORGANIZATION O INNER JOIN BUTTED_ORG B ON O.ID = B.OID" ,tableAlias="O")
10
public class ButtedOrgInfo extends Organization{
11
	
12
	private String buttedTime;
13
	private boolean hasOrgLogo;
14

15
	public boolean isHasOrgLogo() {
16
		return hasOrgLogo;
17
	}
18

19
	public void setHasOrgLogo(boolean hasOrgLogo) {
20
		this.hasOrgLogo = hasOrgLogo;
21
	}
22
	@CalcColumn(column="B.CREATE_TIME BUTTE_TIME",handlerClass=StringHandler.class)
23
	public String getButtedTime() {
24
		return buttedTime;
25
	}
26

27
	public void setButtedTime(String buttedTime) {
28
		this.buttedTime = buttedTime;
29
	}
30
}

+ 31 - 0
src/main/java/com/ekexiu/portal/platform/ButtedProfessorInfo.java

@ -0,0 +1,31 @@
1
package com.ekexiu.portal.platform;
2

3
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
6

7
import com.ekexiu.portal.po.Professor;
8

9
@ExtendView(fromSentence="PROFESSOR P INNER JOIN BUTTED_ORG B ON P.ID = B.OID" ,tableAlias="P")
10
public class ButtedProfessorInfo extends Professor {
11
	private String buttedTime;
12
	private Integer hasHeadImage;
13
	
14

15
	public Integer getHasHeadImage() {
16
		return hasHeadImage;
17
	}
18

19
	public void setHasHeadImage(Integer hasHeadImage) {
20
		this.hasHeadImage = hasHeadImage;
21
	}
22

23
	@CalcColumn(column="B.CREATE_TIME BUTTE_TIME",handlerClass=StringHandler.class)
24
	public String getButtedTime() {
25
		return buttedTime;
26
	}
27

28
	public void setButtedTime(String buttedTime) {
29
		this.buttedTime = buttedTime;
30
	}
31
}

+ 35 - 3
src/main/java/com/ekexiu/portal/platform/PlatformDao.java

@ -6,18 +6,27 @@ import java.util.List;
6 6

7 7
import org.jfw.apt.annotation.Nullable;
8 8
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.method.Exclude;
9 10
import org.jfw.apt.orm.annotation.dao.method.From;
11
import org.jfw.apt.orm.annotation.dao.method.LimitColumn;
12
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
10 13
import org.jfw.apt.orm.annotation.dao.method.Where;
11 14
import org.jfw.apt.orm.annotation.dao.method.operator.Delete;
12 15
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
13 16
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
17
import org.jfw.apt.orm.annotation.dao.method.operator.LimitQuery;
18
import org.jfw.apt.orm.annotation.dao.method.operator.LimitSelect;
19
import org.jfw.apt.orm.annotation.dao.method.operator.QueryList;
14 20
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
15 21
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
16 22
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
17 23
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
18 24
import org.jfw.apt.orm.annotation.dao.param.Alias;
25
import org.jfw.apt.orm.annotation.dao.param.GroupSqlColumn;
19 26
import org.jfw.apt.orm.annotation.dao.param.In;
20 27
import org.jfw.apt.orm.annotation.dao.param.Set;
28
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
29
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
21 30

22 31
@DAO
23 32
public interface PlatformDao {
@ -116,16 +125,39 @@ public interface PlatformDao {
116 125
	@From(ResidentOrg.class)
117 126
	int deleteResidentOrg(Connection con, String pid, String oid) throws SQLException;
118 127

119
	@SelectOne
128
	@DeleteWith
120 129
	@From(ButtedOrg.class)
121 130
	int deleteButtedOrg(Connection con, String pid, String oid) throws SQLException;
122 131

123
	@SelectOne
132
	@DeleteWith
124 133
	@From(ButtedProfessor.class)
125 134
	int deleteButtedProfessor(Connection con, String pid, String uid) throws SQLException;
126 135

127
	@SelectOne
136
	@DeleteWith
128 137
	@From(ReferencedArticle.class)
129 138
	int deleteReferencedArticle(Connection con, String pid, String aid) throws SQLException;
130 139

140
	@LimitQuery
141
	@OrderBy(cols = { @LimitColumn(value = "time", column = "R.CREATE_TIME", handlerClass = StringHandler.class, asc = false),
142
			@LimitColumn(value = "oid", column = "O.ID", asc = false, handlerClass = StringHandler.class) }, value = "")
143
	@Exclude({ "descp" })
144
	List<ResidentOrgInfo> queryResientOrgInfo(Connection con, String time, String oid,
145
			@SqlColumn(handlerClass = StringHandler.class, value = { "R.PID=?" }) String pid,
146
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, isAnd = false, value = { "O.NAME LIKE ?", "O.FOR_SHORT LIKE ?" }) String key,
147
			int rows) throws SQLException;
148

149
	@LimitQuery
150
	@OrderBy(cols = { @LimitColumn(value = "time", column = "B.CREATE_TIME", handlerClass = StringHandler.class, asc = false),
151
			@LimitColumn(value = "oid", column = "O.ID", asc = false, handlerClass = StringHandler.class) }, value = "")
152
	@Exclude({ "descp" })
153
	List<ButtedOrgInfo> queryButtedOrgInfo(Connection con, String time, String oid,
154
			@SqlColumn(handlerClass = StringHandler.class, value = { "B.PID=?" }) String pid, int rows) throws SQLException;
155

156
	@LimitQuery
157
	@OrderBy(cols = { @LimitColumn(value = "time", column = "B.CREATE_TIME", handlerClass = StringHandler.class, asc = false),
158
			@LimitColumn(value = "uid", column = "P.ID", asc = false, handlerClass = StringHandler.class) }, value = "")
159
	@Exclude({ "descp" })
160
	List<ButtedProfessorInfo> queryButtedProfessorInfo(Connection con, String time, String uid,
161
			@SqlColumn(handlerClass = StringHandler.class, value = { "B.PID=?" }) String pid, int rows) throws SQLException;
162

131 163
}

+ 51 - 2
src/main/java/com/ekexiu/portal/platform/PlatformService.java

@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit;
17 17
import java.util.concurrent.atomic.AtomicInteger;
18 18

19 19
import org.jfw.apt.annotation.Autowrie;
20
import org.jfw.apt.annotation.DefaultValue;
20 21
import org.jfw.apt.annotation.Nullable;
21 22
import org.jfw.apt.web.annotation.Path;
22 23
import org.jfw.apt.web.annotation.operate.Get;
@ -35,6 +36,7 @@ import org.jfw.util.web.fileupload.Item;
35 36
import org.jfw.util.web.fileupload.UploadItemIterator;
36 37

37 38
import com.ekexiu.portal.mail.MailService;
39
import com.ekexiu.portal.service.ImageService;
38 40

39 41
@Path("/platform")
40 42
public class PlatformService {
@ -63,6 +65,19 @@ public class PlatformService {
63 65
	private File imgPath;
64 66

65 67
	private int imgMaxWidth = 70;
68
	
69
	@Autowrie
70
	private ImageService imageService;
71
	
72
	
73

74
	public ImageService getImageService() {
75
		return imageService;
76
	}
77

78
	public void setImageService(ImageService imageService) {
79
		this.imageService = imageService;
80
	}
66 81

67 82
	public int getImgMaxWidth() {
68 83
		return imgMaxWidth;
@ -122,7 +137,7 @@ public class PlatformService {
122 137
		return ret;
123 138
	}
124 139

125
	@Path("reqResetPw")
140
	@Path("/reqResetPw")
126 141
	@Post
127 142
	public void requestResetPasswordWithEmail(@JdbcConn Connection con, String mail, @Nullable String url) throws SQLException, JfwBaseException {
128 143
		PlatformUser pu = this.platformDao.queryUser(con, mail);
@ -169,7 +184,7 @@ public class PlatformService {
169 184
		}
170 185
	}
171 186

172
	@Path("reqBindMail")
187
	@Path("/reqBindMail")
173 188
	@Post
174 189
	public void requestBindMail(@JdbcConn Connection con, String mail, String id, @Nullable String url) throws SQLException, JfwBaseException {
175 190
		PlatformUser pu = this.platformDao.queryUser(con, mail);
@ -303,6 +318,40 @@ public class PlatformService {
303 318
			@FieldParam(value = "aid", valueClass = String.class) }) ReferencedArticle po) throws SQLException {
304 319
		return this.platformDao.delete(con, po);
305 320
	}
321
	
322
	
323
	@Get
324
	@Path("/info/residentOrgs")
325
	public List<ResidentOrgInfo> queryResidentOrginfos(@JdbcConn Connection con,@DefaultValue("\"z\"") String time,@DefaultValue("\"z\"") String oid,String pid,@Nullable String key, int rows) throws SQLException{
326
		
327
		List<ResidentOrgInfo> ret = this.platformDao.queryResientOrgInfo(con, time, oid, pid,key==null ?null:("%"+key+"%"), rows);
328
		for(ResidentOrgInfo roi:ret){
329
			roi.setHasOrgLogo(this.imageService.hasOrgLogo(roi.getId()));
330
		}
331
		return ret;
332
	}
333
	
334
	@Get
335
	@Path("/info/buttedOrgs")
336
	public List<ButtedOrgInfo> queryButtedOrginfos(@JdbcConn Connection con,@DefaultValue("\"z\"") String time,@DefaultValue("\"z\"") String oid,String pid,int rows) throws SQLException{
337
		
338
		List<ButtedOrgInfo> ret = this.platformDao.queryButtedOrgInfo(con, time, oid, pid, rows);
339
		for(ButtedOrgInfo roi:ret){
340
			roi.setHasOrgLogo(this.imageService.hasOrgLogo(roi.getId()));
341
		}
342
		return ret;
343
	}
344
	@Get
345
	@Path("/info/buttedProfessors")
346
	public List<ButtedProfessorInfo> queryButtedProfessorinfos(@JdbcConn Connection con,@DefaultValue("\"z\"") String time,@DefaultValue("\"z\"") String uid,String pid,int rows) throws SQLException{
347
		
348
		List<ButtedProfessorInfo> ret = this.platformDao.queryButtedProfessorInfo(con, time, uid, pid, rows);
349
		for(ButtedProfessorInfo roi:ret){
350
			roi.setHasHeadImage(this.imageService.hasProfessorImage(roi.getId()));
351
		}
352
		return ret;
353
	}
354
	
306 355

307 356
	@Post
308 357
	@Path("/upload")

+ 30 - 0
src/main/java/com/ekexiu/portal/platform/ResidentOrgInfo.java

@ -0,0 +1,30 @@
1
package com.ekexiu.portal.platform;
2

3
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
6

7
import com.ekexiu.portal.po.Organization;
8

9
@ExtendView(fromSentence="ORGANIZATION O INNER JOIN RESIDENT_ORG R ON O.ID = R.OID" ,tableAlias="O")
10
public class ResidentOrgInfo extends Organization{
11
	
12
	private String residentTime;
13
	private boolean hasOrgLogo;
14

15
	public boolean isHasOrgLogo() {
16
		return hasOrgLogo;
17
	}
18

19
	public void setHasOrgLogo(boolean hasOrgLogo) {
20
		this.hasOrgLogo = hasOrgLogo;
21
	}
22
	@CalcColumn(column="R.CREATE_TIME RESIDENT_TIME",handlerClass=StringHandler.class)
23
	public String getResidentTime() {
24
		return residentTime;
25
	}
26

27
	public void setResidentTime(String residentTime) {
28
		this.residentTime = residentTime;
29
	}
30
}

+ 23 - 5
src/main/java/com/ekexiu/portal/service/ArticleService.java

@ -887,6 +887,24 @@ public class ArticleService {
887 887
	public List<Article> proPublish(@JdbcConn Connection con, String category, String owner, @DefaultValue("\"9\"") String publishTime,@DefaultValue("Long.MAX_VALUE")long shareId, int rows)throws SQLException {
888 888
			return this.articleDao.publish(con,category, owner, publishTime,shareId, rows);
889 889
	}
890
	
891
	@Get
892
	@Path("/publishInPlatform")
893
	public List<Article> publishInPlatform(@JdbcConn Connection con,String pid, @DefaultValue("\"9\"") String publishTime,@DefaultValue("Long.MAX_VALUE")long shareId, int rows)throws SQLException {
894
			return this.articleDao.publishInPlatform(con,pid, publishTime,shareId, rows);
895
	}
896
	@Get
897
	@Path("/pgPublishInPlatform")
898
	public PageQueryResult<Article> pgPublishInPlatform(@JdbcConn Connection con,String pid,@Nullable String key,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException {
899
			return this.articleDao.publishInPlatform(con,pid,key,pageSize,pageNo);
900
	}
901
	
902
	@Get
903
	@Path("/pgPublishNotInPlatform")
904
	public PageQueryResult<Article> pgPublishNotInPlatform(@JdbcConn Connection con,String pid,@Nullable String key,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException {
905
			return this.articleDao.publishInPlatform(con,pid,key,pageSize,pageNo);
906
	}
907
	
890 908

891 909
	@Get
892 910
	@Path("/qaForDesk")
@ -994,12 +1012,12 @@ public class ArticleService {
994 1012

995 1013
	@Get
996 1014
	@Path("/pqself")
997
	public PageQueryResult<SelfArticle> queryPageSelf(@JdbcConn Connection con, @Nullable String ownerId,
998
			@Nullable String articleTitle, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
999
		if (articleTitle != null) {
1000
			articleTitle = "%" + articleTitle + "%";
1015
	public PageQueryResult<SelfArticle> queryPageSelf(@JdbcConn Connection con, String articleType, String ownerId,
1016
			@Nullable String key, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
1017
		if (key != null) {
1018
			key = "%" + key + "%";
1001 1019
		}
1002
		return this.articleDao.queryPageForSelf(con, ownerId, articleTitle, pageSize, pageNo);
1020
		return this.articleDao.queryPageForSelf(con,articleType,ownerId, key, pageSize, pageNo);
1003 1021
	}
1004 1022

1005 1023
	@Get

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

@ -2262,3 +2262,5 @@ COMMENT ON COLUMN PPATENT.COOPERATION is '合作备注';
2262 2262

2263 2263

2264 2264

2265

2266