瀏覽代碼

统计数量

XMTT 7 年之前
父節點
當前提交
dfc8c5427a

+ 26 - 9
src/main/java/com/ekexiu/portal/dao/ArticleDao.java

@ -4,6 +4,7 @@ import com.ekexiu.portal.po.Article;
4 4
import com.ekexiu.portal.po.ArticleWare;
5 5
import com.ekexiu.portal.pojo.FindInfo;
6 6
import com.ekexiu.portal.pojo.SelfArticle;
7
import org.jfw.apt.annotation.DefaultValue;
7 8
import org.jfw.apt.annotation.Nullable;
8 9
import org.jfw.apt.orm.annotation.dao.DAO;
9 10
import org.jfw.apt.orm.annotation.dao.Dynamic;
@ -18,6 +19,7 @@ import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
18 19
import org.jfw.apt.orm.annotation.dao.method.operator.LimitSelect;
19 20
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
20 21
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
22
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
21 23
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
22 24
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
23 25
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
@ -29,6 +31,7 @@ import org.jfw.apt.orm.annotation.dao.param.LessThan;
29 31
import org.jfw.apt.orm.annotation.dao.param.Like;
30 32
import org.jfw.apt.orm.annotation.dao.param.Set;
31 33
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
34
import org.jfw.apt.orm.annotation.dao.Column;
32 35
import org.jfw.apt.orm.core.defaultImpl.LongHandler;
33 36
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
34 37
import org.jfw.util.PageQueryResult;
@ -52,11 +55,11 @@ public abstract class ArticleDao {
52 55

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

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

60 63
	@UpdateWith
61 64
	@From(Article.class)
62 65
	@SetSentence("PAGE_VIEWS = PAGE_VIEWS + 1")
@ -118,17 +121,23 @@ public abstract class ArticleDao {
118 121
	@Where("STATUS = '1'")
119 122
	public abstract PageQueryResult<Article> pageQueryProPublish(Connection con, String professorId, int pageSize, int pageNo) throws SQLException;
120 123

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

127 136
	@LimitSelect
128 137
	@Exclude("articleContent")
129 138
	@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
130 139
	@Where("STATUS = '1'")
131
	public abstract List<Article> orgPublish(Connection con, String orgId, String publishTime, long shareId, int rows)throws SQLException;
140
	public abstract List<Article> publish(Connection con,String articleType,@GroupSqlColumn(handlerClass = StringHandler.class,value ={"PROFESSOR_ID = ?","ORG_ID = ?"},isAnd = false) String owner, String publishTime, long shareId, int rows)throws SQLException;
132 141

133 142
	@Exclude("articleContent")
134 143
	@SelectList
@ -161,7 +170,7 @@ public abstract class ArticleDao {
161 170
	@SelectOne
162 171
	@Nullable
163 172
	public abstract Article queryOne(Connection con, String articleId) throws SQLException;
164
	
173

165 174
	@SelectList
166 175
	public abstract List<ArticleWare> queryWares(Connection con,String id)throws SQLException;
167 176

@ -905,4 +914,12 @@ public abstract class ArticleDao {
905 914
	@LimitSelect
906 915
	@OrderBy( " ORDER BY PAGE_VIEWS DESC")
907 916
	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;
917

918
	@DefaultValue("0")
919
	@QueryVal
920
	@Where("STATUS = '1'")
921
	@Column(value = "COUNT(1)", handlerClass = LongHandler.class)
922
	@From(Article.class)
923
	public abstract long countPublish(Connection con, String articleType,@GroupSqlColumn(handlerClass = StringHandler.class,value = {"PROFESSOR_ID = ?","ORG_ID = ?"},isAnd = false) String owner) throws SQLException;
924

908 925
}

+ 10 - 0
src/main/java/com/ekexiu/portal/dao/PpaperDao.java

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

3 3
import com.ekexiu.portal.po.Ppaper;
4 4
import com.ekexiu.portal.pojo.AssedPaper;
5
import org.jfw.apt.annotation.DefaultValue;
5 6
import org.jfw.apt.annotation.Nullable;
6 7
import org.jfw.apt.orm.annotation.dao.DAO;
7 8
import org.jfw.apt.orm.annotation.dao.method.Exclude;
@ -14,6 +15,7 @@ import org.jfw.apt.orm.annotation.dao.method.operator.LimitQuery;
14 15
import org.jfw.apt.orm.annotation.dao.method.operator.LimitSelect;
15 16
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
16 17
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
18
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
17 19
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
18 20
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
19 21
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
@ -23,6 +25,7 @@ import org.jfw.apt.orm.annotation.dao.param.In;
23 25
import org.jfw.apt.orm.annotation.dao.param.Like;
24 26
import org.jfw.apt.orm.annotation.dao.param.Set;
25 27
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
28
import org.jfw.apt.orm.annotation.dao.Column;
26 29
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
27 30
import org.jfw.apt.orm.core.defaultImpl.LongHandler;
28 31
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
@ -153,4 +156,11 @@ public abstract class PpaperDao {
153 156
		}
154 157
		return ret.isEmpty() ? null : ret.toArray(new String[ret.size()]);
155 158
	}
159

160
	@DefaultValue("0")
161
	@QueryVal
162
	@Column(value = "count(1)", handlerClass = LongHandler.class)
163
	@From(AssedPaper.class)
164
	public abstract long countPublish(Connection con, String professorId) throws SQLException;
165

156 166
}

+ 9 - 0
src/main/java/com/ekexiu/portal/dao/PpatentDao.java

@ -2,7 +2,9 @@ package com.ekexiu.portal.dao;
2 2

3 3
import com.ekexiu.portal.po.Ppatent;
4 4
import com.ekexiu.portal.pojo.AssedPatent;
5
import org.jfw.apt.annotation.DefaultValue;
5 6
import org.jfw.apt.annotation.Nullable;
7
import org.jfw.apt.orm.annotation.dao.Column;
6 8
import org.jfw.apt.orm.annotation.dao.DAO;
7 9
import org.jfw.apt.orm.annotation.dao.method.Exclude;
8 10
import org.jfw.apt.orm.annotation.dao.method.From;
@ -14,6 +16,7 @@ import org.jfw.apt.orm.annotation.dao.method.operator.LimitQuery;
14 16
import org.jfw.apt.orm.annotation.dao.method.operator.LimitSelect;
15 17
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
16 18
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
19
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
17 20
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
18 21
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
19 22
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
@ -162,4 +165,10 @@ public abstract class PpatentDao {
162 165
		return ret.isEmpty() ? null : ret.toArray(new String[ret.size()]);
163 166
	}
164 167

168
	@DefaultValue("0")
169
	@QueryVal
170
	@Column(value = "count(1)", handlerClass = LongHandler.class)
171
	@From(AssedPatent.class)
172
	public abstract long countPublish(Connection con, String professorId) throws SQLException;
173

165 174
}

+ 10 - 5
src/main/java/com/ekexiu/portal/dao/ResourceDao.java

@ -1099,15 +1099,20 @@ public abstract class ResourceDao {
1099 1099
	@Where("STATUS = '1'")
1100 1100
	public abstract PageQueryResult<Resource> pageQueryProPublish(Connection con,String professorId,int pageSize,int pageNo) throws SQLException;
1101 1101

1102
    @LimitSelect
1103
    @OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false,handlerClass = LongHandler.class)}, value = "")
1104
    @Where("STATUS='1'")
1105
    public abstract List<Resource> proPublish(Connection con, String professorId, String publishTime, long shareId, int rows) throws SQLException;
1102
    //@LimitSelect
1103
    //@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false,handlerClass = LongHandler.class)}, value = "")
1104
    //@Where("STATUS='1'")
1105
    //public abstract List<Resource> proPublish(Connection con, String professorId, String publishTime, long shareId, int rows) throws SQLException;
1106
    //
1107
    //@LimitSelect
1108
    //@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
1109
    //@Where("STATUS='1'")
1110
    //public abstract List<Resource> orgPublish(Connection con, String orgId, String publishTime, long shareId, int rows) throws SQLException;
1106 1111

1107 1112
    @LimitSelect
1108 1113
    @OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
1109 1114
    @Where("STATUS='1'")
1110
    public abstract List<Resource> orgPublish(Connection con, String orgId, String publishTime, long shareId, int rows) throws SQLException;
1115
    public abstract List<Resource> publish(Connection con,String resourceType,@GroupSqlColumn(handlerClass = StringHandler.class,value ={"PROFESSOR_ID = ?","ORG_ID = ?"},isAnd = false) String owner, String publishTime, long shareId, int rows) throws SQLException;
1111 1116

1112 1117
	@SelectList
1113 1118
	@OrderBy("ORDER BY PUBLISH_TIME DESC")

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

@ -54,7 +54,6 @@ import java.text.SimpleDateFormat;
54 54
import java.util.Collections;
55 55
import java.util.Date;
56 56
import java.util.List;
57
import java.util.Objects;
58 57

59 58
@Path("/article")
60 59
public class ArticleService {
@ -889,12 +888,7 @@ public class ArticleService {
889 888
	@Get
890 889
	@Path("/publish")
891 890
	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 {
892
		if (Objects.equals(category, "1")) {
893
			return this.articleDao.proPublish(con, owner, publishTime,shareId, rows);
894
		} else if (Objects.equals(category, "2")) {
895
			return this.articleDao.orgPublish(con, owner, publishTime,shareId, rows);
896
		}
897
		return null;
891
			return this.articleDao.publish(con,category, owner, publishTime,shareId, rows);
898 892
	}
899 893

900 894
	@Get
@ -1161,7 +1155,13 @@ public class ArticleService {
1161 1155
	@Path("/ware")
1162 1156
	public List<ArticleWare> queryWares(@JdbcConn Connection con,String id)throws SQLException{
1163 1157
		return articleDao.queryWares(con, id);
1164
	};
1158
	}
1159

1160
	@Get
1161
	@Path("/count/publish")
1162
	public long countPublish(@JdbcConn Connection con,String category,String owner)throws SQLException {
1163
		return articleDao.countPublish(con, category, owner);
1164
	}
1165 1165

1166 1166
	public static void main(String[] args) {
1167 1167
		System.out.println(DateUtil.formatDate(System.currentTimeMillis() - 7 * 24 * 60 * 60 * 1000));

+ 6 - 0
src/main/java/com/ekexiu/portal/service/PpaperService.java

@ -277,4 +277,10 @@ public class PpaperService {
277 277
			return Collections.<Ppaper> emptyList();
278 278
		return this.ppaperDao.query(con, ids);
279 279
	}
280

281
	@Get
282
	@Path("/count/publish")
283
	public long countPublish(@JdbcConn Connection con,String owner)throws SQLException {
284
		return this.ppaperDao.countPublish(con, owner);
285
	}
280 286
}

+ 6 - 0
src/main/java/com/ekexiu/portal/service/PpatentServcie.java

@ -275,5 +275,11 @@ public class PpatentServcie {
275 275
		if(ids==null || ids.length==0) return Collections.<Ppatent>emptyList();
276 276
		return this.ppatentDao.query(con, ids);		
277 277
	}
278

279
	@Get
280
	@Path("/count/publish")
281
	public long countPublish(@JdbcConn Connection con,String owner)throws SQLException {
282
		return this.ppatentDao.countPublish(con, owner);
283
	}
278 284
	
279 285
}

+ 2 - 8
src/main/java/com/ekexiu/portal/service/ResourceService.java

@ -38,7 +38,6 @@ import java.text.SimpleDateFormat;
38 38
import java.util.Collections;
39 39
import java.util.Date;
40 40
import java.util.List;
41
import java.util.Objects;
42 41

43 42
@Path("/resource")
44 43
public class ResourceService {
@ -837,19 +836,14 @@ public class ResourceService {
837 836
	@Get
838 837
	@Path("/publish")
839 838
	List<Resource> queryPublish(@JdbcConn Connection con, String category, String owner, @DefaultValue("\"9\"") String publishTime,@DefaultValue("Long.MAX_VALUE")long shareId, int rows) throws SQLException {
840
		List<Resource> resources = null;
841
		if (Objects.equals(category, "1")) {
842
			resources = this.resourceDao.proPublish(con, owner, publishTime,shareId, rows);
843
		} else if (Objects.equals(category, "2")) {
844
			resources = this.resourceDao.orgPublish(con, owner, publishTime,shareId, rows);
845
		}
839
		List<Resource> resources = this.resourceDao.publish(con, category, owner, publishTime, shareId, rows);
846 840
		if (resources != null && resources.size() > 0) {
847 841
			for (Resource resource : resources) {
848 842
				resource.setImages(this.imageDao.queryRes(con, resource.getResourceId()));
849 843
			}
850 844
			return resources;
851 845
		} else {
852
			return null;
846
			return Collections.emptyList();
853 847
		}
854 848
	}
855 849