Przeglądaj źródła

--新的文章和资源相关接口;

zzy.zhiyuan.foxmail 8 lat temu
rodzic
commit
7580670b32

+ 63 - 7
src/main/java/com/ekexiu/portal/dao/ArticleDao.java

@ -104,18 +104,33 @@ public abstract class ArticleDao {
104 104
	@Where("STATUS = '1'")
105 105
	public abstract PageQueryResult<Article> queryPageForPublish(Connection con,@Like@Nullable String articleTitle,int pageSize,int pageNo) throws SQLException;
106 106
	
107
	public PageQueryResult<Article> queryPageForSelf(Connection con,@Nullable String articleTitle,int pageSize,int pageNo) throws SQLException{
107
	public PageQueryResult<Article> queryPageForSelf(Connection con,@Nullable String professorId,@Nullable String orgId,
108
			@Nullable String articleTitle,int pageSize,int pageNo) throws SQLException{
108 109
        int total = 0;
109 110
        PageQueryResult<Article> queryResult = new PageQueryResult<Article>();
110 111
        int index = 1;
112
        boolean hasProfessorId = null != professorId;
113
        boolean hasOrgId = null != orgId;
111 114
        boolean hasArticleTitle = null != articleTitle;
112 115
        StringBuilder sql = new StringBuilder();
113 116
        sql.append("SELECT COUNT(1) FROM ARTICLE WHERE STATUS IN('0','1','2')");
117
        if(hasProfessorId){
118
        	sql.append(" AND PROFESSOR_ID = ?");
119
        }
120
        if(hasOrgId){
121
        	sql.append(" AND ORG_ID = ?");
122
        }
114 123
        if(hasArticleTitle){
115 124
        	sql.append(" AND ARTICLE_TITLE LIKE ?");
116 125
        }
117 126
        PreparedStatement ps = con.prepareStatement(sql.toString());
118 127
        try{
128
        	if(hasProfessorId){
129
        		ps.setString(index++, professorId);
130
        	}
131
        	if(hasOrgId){
132
        		ps.setString(index++, orgId);
133
        	}
119 134
        	if(hasArticleTitle){
120 135
        		ps.setString(index++, articleTitle);
121 136
        	}
@ -141,10 +156,22 @@ public abstract class ArticleDao {
141 156
        	queryResult.setPageNo(1);
142 157
        	sql = new StringBuilder();
143 158
        	sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE WHERE STATUS IN('0','2')");
159
        	if(hasProfessorId){
160
            	sql.append(" AND PROFESSOR_ID = ?");
161
            }
162
            if(hasOrgId){
163
            	sql.append(" AND ORG_ID = ?");
164
            }
144 165
        	if(hasArticleTitle){
145 166
        		sql.append(" AND ARTICLE_TITLE LIKE ?");
146 167
        	}
147 168
        	sql.append(" ORDER BY MODIFY_TIME DESC) UNION ALL (SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE WHERE STATUS = '1'");
169
        	if(hasProfessorId){
170
            	sql.append(" AND PROFESSOR_ID = ?");
171
            }
172
            if(hasOrgId){
173
            	sql.append(" AND ORG_ID = ?");
174
            }
148 175
        	if(hasArticleTitle){
149 176
        		sql.append(" AND ARTICLE_TITLE LIKE ?");
150 177
        	}
@ -161,11 +188,24 @@ public abstract class ArticleDao {
161 188
            queryResult.setPageNo(pageNo);
162 189
            --pageNo;
163 190
            int offset = (pageNo * pageSize);
191
            sql = new StringBuilder();
164 192
            sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE WHERE STATUS IN('0','2')");
193
        	if(hasProfessorId){
194
            	sql.append(" AND PROFESSOR_ID = ?");
195
            }
196
            if(hasOrgId){
197
            	sql.append(" AND ORG_ID = ?");
198
            }
165 199
        	if(hasArticleTitle){
166 200
        		sql.append(" AND ARTICLE_TITLE LIKE ?");
167 201
        	}
168 202
        	sql.append(" ORDER BY MODIFY_TIME DESC) UNION ALL (SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE WHERE STATUS = '1'");
203
        	if(hasProfessorId){
204
            	sql.append(" AND PROFESSOR_ID = ?");
205
            }
206
            if(hasOrgId){
207
            	sql.append(" AND ORG_ID = ?");
208
            }
169 209
        	if(hasArticleTitle){
170 210
        		sql.append(" AND ARTICLE_TITLE LIKE ?");
171 211
        	}
@ -173,9 +213,25 @@ public abstract class ArticleDao {
173 213
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(offset);
174 214
        }
175 215
        ps = con.prepareStatement(sql.toString());
216
        System.out.println(sql.toString());
217
        index = 1;
176 218
        try{
219
        	if(hasProfessorId){
220
        		ps.setString(index++, professorId);
221
        	}
222
        	if(hasOrgId){
223
        		ps.setString(index++, orgId);
224
        	}
177 225
        	if(hasArticleTitle){
178 226
        		ps.setString(index++, articleTitle);
227
        	}
228
        	if(hasProfessorId){
229
        		ps.setString(index++, professorId);
230
        	}
231
        	if(hasOrgId){
232
        		ps.setString(index++, orgId);
233
        	}
234
        	if(hasArticleTitle){
179 235
        		ps.setString(index++, articleTitle);
180 236
        	}
181 237
            ResultSet rs = ps.executeQuery();
@ -187,11 +243,11 @@ public abstract class ArticleDao {
187 243
                    ++size;
188 244
                    Article article =  new Article();
189 245
                    article.setArticleId(rs.getString(1));
190
                    String professorId = rs.getString(2);
246
                    String proId = rs.getString(2);
191 247
                    if(rs.wasNull()){
192
                    	professorId = null;
248
                    	proId = null;
193 249
                    }
194
                    article.setProfessorId(professorId);
250
                    article.setProfessorId(proId);
195 251
                    article.setArticleTitle(rs.getString(3));
196 252
                    String articleContent = rs.getString(4);
197 253
                    if(rs.wasNull()){
@ -218,11 +274,11 @@ public abstract class ArticleDao {
218 274
                    	articleImg = null;
219 275
                    }
220 276
                    article.setArticleImg(articleImg);
221
                    String orgId = rs.getString(9);
277
                    String org = rs.getString(9);
222 278
                    if(rs.wasNull()){
223
                    	orgId = null;
279
                    	org = null;
224 280
                    }
225
                    article.setOrgId(orgId);
281
                    article.setOrgId(org);
226 282
                    String articleType = rs.getString(10);
227 283
                    if(rs.wasNull()){
228 284
                    	articleType = null;

+ 27 - 3
src/main/java/com/ekexiu/portal/dao/ArticleResDao.java

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

3 3
import java.sql.Connection;
4
import java.sql.PreparedStatement;
5
import java.sql.ResultSet;
4 6
import java.sql.SQLException;
7
import java.util.ArrayList;
5 8
import java.util.List;
6 9

7 10
import org.jfw.apt.annotation.DefaultValue;
@ -11,7 +14,6 @@ import org.jfw.apt.orm.annotation.dao.method.From;
11 14
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
12 15
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13 16
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
15 17
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
16 18

17 19
import com.ekexiu.portal.po.ArticlePro;
@ -28,8 +30,30 @@ public abstract class ArticleResDao {
28 30
	@DefaultValue("0")
29 31
	public abstract int queryByArticleId(Connection con, String articleId) throws SQLException;
30 32

31
	@SelectList
32
	public abstract List<ArticleRes> query(Connection con, String articleId) throws SQLException;
33
	public List<ArticleRes> query(Connection con,java.lang.String articleId) throws SQLException{
34
        int index = 1;
35
        String sql = "SELECT ARTICLE_ID,A.RESOURCE_ID,A.CREATE_TIME FROM ARTICLE_RES A INNER JOIN RESOURCE R ON A.RESOURCE_ID = R.RESOURCE_ID WHERE R.STATUS = '1' AND ARTICLE_ID = ?";
36
        PreparedStatement ps = con.prepareStatement(sql);
37
        try{
38
            ps.setString(index++,articleId);
39
            ResultSet rs = ps.executeQuery();
40
            try{
41
                List<ArticleRes> result = new ArrayList<ArticleRes>();
42
                while(rs.next()){
43
                    ArticleRes articleRes =  new ArticleRes();
44
                    articleRes.setArticleId(rs.getString(1));
45
                    articleRes.setResourceId(rs.getString(2));
46
                    articleRes.setCreateTime(rs.getString(3));
47
                    result.add(articleRes);
48
                }
49
                return result;
50
            }finally{
51
                try{rs.close();}catch(Exception e1){}
52
            }
53
        }finally{
54
            try{ps.close();}catch(Exception e2){}
55
        }
56
    }
33 57
	
34 58
	@DeleteWith
35 59
	@From(ArticleRes.class)

+ 8 - 0
src/main/java/com/ekexiu/portal/dao/OrgDao.java

@ -10,6 +10,8 @@ import org.jfw.apt.annotation.Nullable;
10 10
import org.jfw.apt.orm.annotation.dao.Column;
11 11
import org.jfw.apt.orm.annotation.dao.DAO;
12 12
import org.jfw.apt.orm.annotation.dao.method.From;
13
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
14
import org.jfw.apt.orm.annotation.dao.method.Select;
13 15
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
14 16
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
15 17
import org.jfw.apt.orm.annotation.dao.method.operator.LimitQuery;
@ -143,6 +145,12 @@ public abstract class OrgDao {
143 145
	@LimitQuery
144 146
	public abstract List<Organization> limitQuery(Connection con, @Like String name,int rows)throws SQLException;
145 147
	
148
	@LimitQuery
149
	@From(Organization.class)
150
	@OrderBy("ORDER BY NAME")
151
	@Select(Organization.class)
152
	public abstract List<EditOrganization> queryLimit(Connection con,@Like String name,int rows)throws SQLException;
153
	
146 154
	@Nullable
147 155
	@QueryVal
148 156
	@Column(handlerClass=StringHandler.class,value="id")

+ 69 - 0
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

@ -341,6 +341,75 @@ public abstract class ProfessorDao {
341 341
        }
342 342
	}
343 343
	
344
	public List<EditProfessor> queryByName(Connection con,String name,int total) throws SQLException{
345
        int index = 1;
346
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT "
347
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.NAME LIKE ? ORDER BY P.SCORE_PERCENT DESC LIMIT ? ";
348
        PreparedStatement ps = con.prepareStatement(sql);
349
        try{
350
            ps.setString(index++,name);
351
            ps.setInt(index++, total);
352
            ResultSet rs = ps.executeQuery();
353
            try{
354
                List<EditProfessor> editProfessors = new ArrayList<EditProfessor>();
355
                while(rs.next()){
356
                	EditProfessor professor =  new EditProfessor();
357
                	String office = rs.getString(1);
358
                	if(rs.wasNull()){
359
                		office = null;
360
                	}
361
                    professor.setOffice(office);
362
                    String depart = rs.getString(2);
363
                    if(rs.wasNull()){
364
                    	depart = null;
365
                	}
366
                    professor.setDepartment(depart);
367
                    String title = rs.getString(3);
368
                    if(rs.wasNull()){
369
                    	title = null;
370
                	}
371
                    professor.setTitle(title);
372
                    Integer auth = rs.getInt(4);
373
                    if(rs.wasNull()){
374
                    	auth = null;
375
                    }
376
                    professor.setAuthentication(auth);
377
                    professor.setAuthType(rs.getInt(5));
378
                    professor.setAuthStatus(rs.getInt(6));
379
                    professor.setId(rs.getString(7));
380
                    professor.setName(rs.getString(8));
381
                    String address = rs.getString(9);
382
                    if(rs.wasNull()){
383
                    	address = null;
384
                	}
385
                    professor.setAddress(address);
386
                    professor.setOrgAuth(rs.getString(10));
387
                    String orgName = rs.getString(11);
388
                    if(rs.wasNull()){
389
                    	orgName = null;
390
                    }
391
                    professor.setOrgName(orgName);
392
                    String orgId = rs.getString(12);
393
                    if(rs.wasNull()){
394
                    	orgId = null;
395
                    }
396
                    professor.setOrgId(orgId);
397
                    String scorePercent = rs.getString(13);
398
                    if(rs.wasNull()){
399
                    	scorePercent = null;
400
                    }
401
                    professor.setScorePercent(scorePercent);
402
                    editProfessors.add(professor);
403
                }
404
                return editProfessors;
405
            }finally{
406
                try{rs.close();}catch(Exception e1){}
407
            }
408
        }finally{
409
            try{ps.close();}catch(Exception e2){}
410
        }
411
    }
412
	
344 413
	/**
345 414
	 * 查询专家基本信息+星级+咨询次数的接口
346 415
	 * @param con

+ 29 - 1
src/main/java/com/ekexiu/portal/dao/ResourceDao.java

@ -9,12 +9,19 @@ import java.util.Collections;
9 9
import java.util.List;
10 10

11 11
import org.jfw.apt.annotation.Autowrie;
12
import org.jfw.apt.annotation.Nullable;
12 13
import org.jfw.apt.orm.annotation.dao.DAO;
14
import org.jfw.apt.orm.annotation.dao.Dynamic;
13 15
import org.jfw.apt.orm.annotation.dao.method.From;
16
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
17
import org.jfw.apt.orm.annotation.dao.method.Where;
14 18
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
15 19
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
20
import org.jfw.apt.orm.annotation.dao.method.operator.LimitSelect;
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;
24
import org.jfw.apt.orm.annotation.dao.param.Like;
18 25
import org.jfw.apt.orm.annotation.dao.param.Set;
19 26
import org.jfw.util.PageQueryResult;
20 27

@ -52,6 +59,18 @@ public abstract class ResourceDao {
52 59
	@Update
53 60
	public abstract int update(Connection con,Resource resource) throws SQLException;
54 61
	
62
	@Update
63
	@Dynamic
64
	public abstract int updateRes(Connection con,Resource resource) throws SQLException;
65
	
66
	@UpdateWith
67
	@From(Resource.class)
68
	public abstract int updateStatus(Connection con, String resourceId, @Set String status) throws SQLException;
69
	
70
	@UpdateWith
71
	@From(Resource.class)
72
	public abstract int updatePublishTime(Connection con,String resourceId,@Set String status,@Set String publishTime)throws SQLException;
73
	
55 74
	@UpdateWith
56 75
	@From(Resource.class)
57 76
	public abstract int updateNameAndSupport(Connection con, String resourceId, @Set String resourceName, 
@ -85,6 +104,10 @@ public abstract class ResourceDao {
85 104
	@From(Resource.class)
86 105
	public abstract int delete(Connection con, String resourceId) throws SQLException;
87 106
	
107
	@SelectOne
108
	@Nullable
109
	public abstract Resource queryOne(Connection con, String resourceId) throws SQLException;
110
	
88 111
	/**
89 112
	 * 查询资源基础信息(ID,名称,学术领域,应用行业,可提供服务,发布者ID,资源图片)
90 113
	 * @param con
@ -93,7 +116,6 @@ public abstract class ResourceDao {
93 116
	 * @throws SQLException
94 117
	 */
95 118
	public Resource queryBaseInfo(Connection con,String resourceId) throws SQLException{
96
        List<Image> images = this.imageDao.queryRes(con, resourceId);
97 119
        String sql = "SELECT RESOURCE_ID,RESOURCE_NAME,SUBJECT,INDUSTRY,SUPPORTED_SERVICES,PROFESSOR_ID"
98 120
        		+ " FROM RESOURCE WHERE RESOURCE_ID = ?";
99 121
        PreparedStatement ps = con.prepareStatement(sql);
@ -117,6 +139,7 @@ public abstract class ResourceDao {
117 139
                    resource.setIndustry(industry);
118 140
                    resource.setSupportedServices(rs.getString(5));
119 141
                    resource.setProfessorId(rs.getString(6));
142
                    List<Image> images = this.imageDao.queryRes(con, resourceId);
120 143
                    resource.setImages(images);
121 144
                    return resource;
122 145
                }else{
@ -394,6 +417,11 @@ public abstract class ResourceDao {
394 417
        }
395 418
    }
396 419
	
420
	@LimitSelect
421
	@Where("STATUS = '1'")
422
	@OrderBy("ORDER BY PUBLISH_TIME DESC")
423
	public abstract List<Resource> queryByName(Connection con, @Like String resourceName, int rows) throws SQLException;
424
	
397 425
	/**
398 426
	 * 按专家ID查询发布的所有资源
399 427
	 * @param con

+ 9 - 2
src/main/java/com/ekexiu/portal/po/Image.java

@ -3,12 +3,14 @@ package com.ekexiu.portal.po;
3 3
import org.jfw.apt.orm.annotation.entry.Column;
4 4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5 5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
6 7
import org.jfw.apt.orm.core.enums.DE;
7 8

8 9
@PrimaryKey("imageId")
9 10
@Table
10 11
public class Image {
11 12
	private String imageId;
13
	private int sort;
12 14
	private String imageSrc;
13 15
	private String resourceId;
14 16
	private Resource resource;
@ -26,7 +28,13 @@ public class Image {
26 28
	public void setImageId(String imageId) {
27 29
		this.imageId = imageId;
28 30
	}
29
	
31
	@Column(handlerClass=IntHandler.class, dbType="INTEGER", nullable=true)
32
	public int getSort() {
33
		return sort;
34
	}
35
	public void setSort(int sort) {
36
		this.sort = sort;
37
	}
30 38
	@Column(DE.string_de)
31 39
	public String getImageSrc() {
32 40
		return imageSrc;
@ -34,7 +42,6 @@ public class Image {
34 42
	public void setImageSrc(String imageSrc) {
35 43
		this.imageSrc = imageSrc;
36 44
	}
37
	
38 45
	@Column(DE.id_32)
39 46
	public String getResourceId() {
40 47
		return resourceId;

+ 63 - 1
src/main/java/com/ekexiu/portal/po/Resource.java

@ -5,6 +5,7 @@ import java.util.List;
5 5
import org.jfw.apt.orm.annotation.entry.Column;
6 6
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
7 7
import org.jfw.apt.orm.annotation.entry.Table;
8
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
8 9
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
9 10
import org.jfw.apt.orm.core.enums.DE;
10 11

@ -17,12 +18,28 @@ import com.ekexiu.portal.pojo.EditProfessor;
17 18
public class Resource implements CreateTimeSupported, ModifyTimeSupported{
18 19
	private String resourceId;
19 20
	private String resourceName;
21
	/**
22
	 * 关键字
23
	 */
20 24
	private String subject;
21 25
	private String industry;
22 26
	/**
23
	 * 资源提供的服务
27
	 * 资源提供的服务、应用用途
24 28
	 */
25 29
	private String supportedServices;
30
	private String orgName;
31
	/**
32
	 * 厂商及型号规格
33
	 */
34
	private String spec;
35
	/**
36
	 * 性能参数
37
	 */
38
	private String parameter;
39
	/**
40
	 * 
41
	 */
42
	private String status;
26 43
	private String descp;
27 44
	private String professorId;
28 45
	private Professor professor;
@ -39,6 +56,10 @@ public class Resource implements CreateTimeSupported, ModifyTimeSupported{
39 56
	 * 合作备注
40 57
	 */
41 58
	private String cooperationNotes;
59
	/**
60
	 * 发布时间
61
	 */
62
	private String publishTime;
42 63
	
43 64
	public List<Image> getImages() {
44 65
		return images;
@ -101,6 +122,38 @@ public class Resource implements CreateTimeSupported, ModifyTimeSupported{
101 122
		this.supportedServices = supportedServices;
102 123
	}
103 124
	
125
	@Column(DE.String_de)
126
	public String getOrgName() {
127
		return orgName;
128
	}
129
	public void setOrgName(String orgName) {
130
		this.orgName = orgName;
131
	}
132
	
133
	@Column(DE.String_de)
134
	public String getSpec() {
135
		return spec;
136
	}
137
	public void setSpec(String spec) {
138
		this.spec = spec;
139
	}
140
	
141
	@Column(handlerClass=FixLenStringHandler.class,dbType="TEXT",nullable=true)
142
	public String getParameter() {
143
		return parameter;
144
	}
145
	public void setParameter(String parameter) {
146
		this.parameter = parameter;
147
	}
148
	
149
	@Column(handlerClass=FixLenStringHandler.class,dbType="CHAR(1)",nullable=true,renewable=false)
150
	public String getStatus() {
151
		return status;
152
	}
153
	public void setStatus(String status) {
154
		this.status = status;
155
	}
156
	
104 157
	@Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=true,queryable=true)
105 158
	public String getDescp() {
106 159
		return descp;
@ -154,4 +207,13 @@ public class Resource implements CreateTimeSupported, ModifyTimeSupported{
154 207
	public void setCooperationNotes(String cooperationNotes) {
155 208
		this.cooperationNotes = cooperationNotes;
156 209
	}
210
	
211
	@Column(handlerClass=FixLenStringHandler.class,dbType="CHAR(14)",nullable=true,renewable=false)
212
	public String getPublishTime() {
213
		return publishTime;
214
	}
215
	public void setPublishTime(String publishTime) {
216
		this.publishTime = publishTime;
217
	}
218
	
157 219
}

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

@ -288,8 +288,8 @@ public class ArticleService {
288 288
	
289 289
	@Post
290 290
	@Path("/save")
291
	public String saveArticle(@JdbcConn(true) Connection con,Article article,String[] professors,String[] resources)
292
			throws SQLException, IOException, JfwBaseException{
291
	public String saveArticle(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
292
			@Nullable String[] resources) throws SQLException, IOException, JfwBaseException{
293 293
		if(article.getArticleId() == null){
294 294
			String articleId = StringUtil.buildUUID();
295 295
			if(article.getArticleImg() != null){
@ -309,17 +309,21 @@ public class ArticleService {
309 309
				throw new JfwBaseException(-1, "错误参数:文章发布者ID");
310 310
			}
311 311
			this.articleDao.insert(con, article);
312
			for (String professor : professors) {
313
				ArticlePro articlePro = new ArticlePro();
314
				articlePro.setArticleId(articleId);
315
				articlePro.setProfessorId(professor);
316
				this.articleProDao.insert(con, articlePro);
312
			if(professors != null){
313
				for (String professor : professors) {
314
					ArticlePro articlePro = new ArticlePro();
315
					articlePro.setArticleId(articleId);
316
					articlePro.setProfessorId(professor);
317
					this.articleProDao.insert(con, articlePro);
318
				}
317 319
			}
318
			for (String resource : resources) {
319
				ArticleRes articleRes = new ArticleRes();
320
				articleRes.setArticleId(articleId);
321
				articleRes.setResourceId(resource);
322
				this.articleResDao.insert(con, articleRes);
320
			if(resources != null){
321
				for (String resource : resources) {
322
					ArticleRes articleRes = new ArticleRes();
323
					articleRes.setArticleId(articleId);
324
					articleRes.setResourceId(resource);
325
					this.articleResDao.insert(con, articleRes);
326
				}
323 327
			}
324 328
			return articleId;
325 329
		}else if(article.getArticleId().trim().length() == 32){
@ -331,17 +335,21 @@ public class ArticleService {
331 335
			this.articleDao.updatePublishTime(con, article.getArticleId(), "1", this.publishTime());
332 336
			this.articleProDao.delete(con, article.getArticleId());
333 337
			this.articleResDao.delete(con, article.getArticleId());
334
			for (String professor : professors) {
335
				ArticlePro articlePro = new ArticlePro();
336
				articlePro.setArticleId(article.getArticleId());
337
				articlePro.setProfessorId(professor);
338
				this.articleProDao.insert(con, articlePro);
338
			if(professors != null){
339
				for (String professor : professors) {
340
					ArticlePro articlePro = new ArticlePro();
341
					articlePro.setArticleId(article.getArticleId());
342
					articlePro.setProfessorId(professor);
343
					this.articleProDao.insert(con, articlePro);
344
				}
339 345
			}
340
			for (String resource : resources) {
341
				ArticleRes articleRes = new ArticleRes();
342
				articleRes.setArticleId(article.getArticleId());
343
				articleRes.setResourceId(resource);
344
				this.articleResDao.insert(con, articleRes);
346
			if(resources != null){
347
				for (String resource : resources) {
348
					ArticleRes articleRes = new ArticleRes();
349
					articleRes.setArticleId(article.getArticleId());
350
					articleRes.setResourceId(resource);
351
					this.articleResDao.insert(con, articleRes);
352
				}
345 353
			}
346 354
			return article.getArticleId();
347 355
		}else{
@ -351,8 +359,8 @@ public class ArticleService {
351 359
	
352 360
	@Post
353 361
	@Path("/draft")
354
	public String draft(@JdbcConn(true) Connection con,Article article,String[] professors,String[] resources)
355
			throws SQLException, IOException, JfwBaseException{
362
	public String draft(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
363
			@Nullable String[] resources) throws SQLException, IOException, JfwBaseException{
356 364
		if(article.getArticleId() == null){
357 365
			String articleId = StringUtil.buildUUID();
358 366
			if(article.getArticleImg() != null){
@ -371,17 +379,21 @@ public class ArticleService {
371 379
				throw new JfwBaseException(-1, "错误参数:文章发布者ID");
372 380
			}
373 381
			this.articleDao.insert(con, article);
374
			for (String professor : professors) {
375
				ArticlePro articlePro = new ArticlePro();
376
				articlePro.setArticleId(articleId);
377
				articlePro.setProfessorId(professor);
378
				this.articleProDao.insert(con, articlePro);
382
			if(professors != null){
383
				for (String professor : professors) {
384
					ArticlePro articlePro = new ArticlePro();
385
					articlePro.setArticleId(articleId);
386
					articlePro.setProfessorId(professor);
387
					this.articleProDao.insert(con, articlePro);
388
				}
379 389
			}
380
			for (String resource : resources) {
381
				ArticleRes articleRes = new ArticleRes();
382
				articleRes.setArticleId(articleId);
383
				articleRes.setResourceId(resource);
384
				this.articleResDao.insert(con, articleRes);
390
			if(resources != null){
391
				for (String resource : resources) {
392
					ArticleRes articleRes = new ArticleRes();
393
					articleRes.setArticleId(articleId);
394
					articleRes.setResourceId(resource);
395
					this.articleResDao.insert(con, articleRes);
396
				}
385 397
			}
386 398
			return articleId;
387 399
		}else if(article.getArticleId().trim().length() == 32){
@ -393,17 +405,21 @@ public class ArticleService {
393 405
			this.articleDao.updateStatus(con, article.getArticleId(), "0");
394 406
			this.articleProDao.delete(con, article.getArticleId());
395 407
			this.articleResDao.delete(con, article.getArticleId());
396
			for (String professor : professors) {
397
				ArticlePro articlePro = new ArticlePro();
398
				articlePro.setArticleId(article.getArticleId());
399
				articlePro.setProfessorId(professor);
400
				this.articleProDao.insert(con, articlePro);
408
			if(professors != null){
409
				for (String professor : professors) {
410
					ArticlePro articlePro = new ArticlePro();
411
					articlePro.setArticleId(article.getArticleId());
412
					articlePro.setProfessorId(professor);
413
					this.articleProDao.insert(con, articlePro);
414
				}
401 415
			}
402
			for (String resource : resources) {
403
				ArticleRes articleRes = new ArticleRes();
404
				articleRes.setArticleId(article.getArticleId());
405
				articleRes.setResourceId(resource);
406
				this.articleResDao.insert(con, articleRes);
416
			if(resources != null){
417
				for (String resource : resources) {
418
					ArticleRes articleRes = new ArticleRes();
419
					articleRes.setArticleId(article.getArticleId());
420
					articleRes.setResourceId(resource);
421
					this.articleResDao.insert(con, articleRes);
422
				}
407 423
			}
408 424
			return article.getArticleId();
409 425
		}else{
@ -413,8 +429,8 @@ public class ArticleService {
413 429
	
414 430
	@Post
415 431
	@Path("/timing")
416
	public String timingPublish(@JdbcConn(true) Connection con,Article article,String[] professors,String[] resources)
417
			throws SQLException, IOException, JfwBaseException{
432
	public String timingPublish(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
433
			@Nullable String[] resources) throws SQLException, IOException, JfwBaseException{
418 434
		if(article.getPublishTime() == null){
419 435
			throw new JfwBaseException(-3, "no parameter found:publishTime");
420 436
		}
@ -436,17 +452,21 @@ public class ArticleService {
436 452
				throw new JfwBaseException(-1, "错误参数:文章发布者ID");
437 453
			}
438 454
			this.articleDao.insert(con, article);
439
			for (String professor : professors) {
440
				ArticlePro articlePro = new ArticlePro();
441
				articlePro.setArticleId(articleId);
442
				articlePro.setProfessorId(professor);
443
				this.articleProDao.insert(con, articlePro);
455
			if(professors != null){
456
				for (String professor : professors) {
457
					ArticlePro articlePro = new ArticlePro();
458
					articlePro.setArticleId(articleId);
459
					articlePro.setProfessorId(professor);
460
					this.articleProDao.insert(con, articlePro);
461
				}
444 462
			}
445
			for (String resource : resources) {
446
				ArticleRes articleRes = new ArticleRes();
447
				articleRes.setArticleId(articleId);
448
				articleRes.setResourceId(resource);
449
				this.articleResDao.insert(con, articleRes);
463
			if(resources != null){
464
				for (String resource : resources) {
465
					ArticleRes articleRes = new ArticleRes();
466
					articleRes.setArticleId(articleId);
467
					articleRes.setResourceId(resource);
468
					this.articleResDao.insert(con, articleRes);
469
				}
450 470
			}
451 471
			return articleId;
452 472
		}else if(article.getArticleId().trim().length() == 32){
@ -456,19 +476,24 @@ public class ArticleService {
456 476
			}
457 477
			this.articleDao.update(con, article);
458 478
			this.articleDao.updatePublishTime(con, article.getArticleId(), "2", article.getPublishTime());
479
			this.articleResDao.delete(con, article.getArticleId());
459 480
			this.articleProDao.delete(con, article.getArticleId());
460 481
			this.articleResDao.delete(con, article.getArticleId());
461
			for (String professor : professors) {
462
				ArticlePro articlePro = new ArticlePro();
463
				articlePro.setArticleId(article.getArticleId());
464
				articlePro.setProfessorId(professor);
465
				this.articleProDao.insert(con, articlePro);
482
			if(professors != null){
483
				for (String professor : professors) {
484
					ArticlePro articlePro = new ArticlePro();
485
					articlePro.setArticleId(article.getArticleId());
486
					articlePro.setProfessorId(professor);
487
					this.articleProDao.insert(con, articlePro);
488
				}
466 489
			}
467
			for (String resource : resources) {
468
				ArticleRes articleRes = new ArticleRes();
469
				articleRes.setArticleId(article.getArticleId());
470
				articleRes.setResourceId(resource);
471
				this.articleResDao.insert(con, articleRes);
490
			if(resources != null){
491
				for (String resource : resources) {
492
					ArticleRes articleRes = new ArticleRes();
493
					articleRes.setArticleId(article.getArticleId());
494
					articleRes.setResourceId(resource);
495
					this.articleResDao.insert(con, articleRes);
496
				}
472 497
			}
473 498
			return article.getArticleId();
474 499
		}else{
@ -581,12 +606,12 @@ public class ArticleService {
581 606
	
582 607
	@Get
583 608
	@Path("/pqself")
584
	public PageQueryResult<Article> queryPageSelf(@JdbcConn Connection con,@Nullable String articleTitle,
585
			@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
609
	public PageQueryResult<Article> queryPageSelf(@JdbcConn Connection con,@Nullable String professorId,@Nullable String orgId,
610
			@Nullable String articleTitle,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
586 611
		if(articleTitle != null){
587 612
			articleTitle = "%" + articleTitle + "%";
588 613
		}
589
		return this.articleDao.queryPageForSelf(con, articleTitle, pageSize, pageNo);
614
		return this.articleDao.queryPageForSelf(con, professorId, orgId, articleTitle, pageSize, pageNo);
590 615
	}
591 616
	
592 617
	@Get

+ 47 - 0
src/main/java/com/ekexiu/portal/service/ImagesService.java

@ -10,6 +10,8 @@ import java.io.IOException;
10 10
import java.io.InputStream;
11 11
import java.sql.Connection;
12 12
import java.sql.SQLException;
13
import java.text.SimpleDateFormat;
14
import java.util.Date;
13 15
import java.util.List;
14 16

15 17
import javax.imageio.ImageIO;
@ -36,7 +38,9 @@ import com.ekexiu.portal.util.PictureRotating;
36 38
public class ImagesService {
37 39
	private File tmpPath;
38 40
	private File resourcePath;
41
	private File resourceDataPath;
39 42
	private int resImageMaxLen = 240;
43
	private String dateFormat = "yyyyMM";
40 44
	private static final String JPG = "jpg";
41 45
	@Autowrie
42 46
	private ImageDao imageDao;
@ -57,6 +61,14 @@ public class ImagesService {
57 61
		this.resourcePath = resourcePath;
58 62
	}
59 63

64
	public File getResourceDataPath() {
65
		return resourceDataPath;
66
	}
67

68
	public void setResourceDataPath(File resourceDataPath) {
69
		this.resourceDataPath = resourceDataPath;
70
	}
71

60 72
	public int getResImageMaxLen() {
61 73
		return resImageMaxLen;
62 74
	}
@ -65,6 +77,14 @@ public class ImagesService {
65 77
		this.resImageMaxLen = resImageMaxLen;
66 78
	}
67 79

80
	public String getDateFormat() {
81
		return dateFormat;
82
	}
83

84
	public void setDateFormat(String dateFormat) {
85
		this.dateFormat = dateFormat;
86
	}
87

68 88
	public ImageDao getImageDao() {
69 89
		return imageDao;
70 90
	}
@ -95,6 +115,12 @@ public class ImagesService {
95 115
		}
96 116
	}
97 117
	
118
	private String createDate(){
119
		SimpleDateFormat df = new SimpleDateFormat(this.dateFormat);
120
		String date = df.format(new Date());
121
		return date;
122
	}
123
	
98 124
	@Post
99 125
	@Path("/resourceImg")
100 126
	public String insert(@JdbcConn(true) Connection con, String resourceId, String fn) 
@ -119,6 +145,27 @@ public class ImagesService {
119 145
		}
120 146
	}
121 147
	
148
	@Post
149
	@Path("/saveImg")
150
	public void saveImg(@JdbcConn(true) Connection con, String resourceId, String[] fns) 
151
			throws SQLException, IOException, JfwBaseException {
152
		for (int i = 0; i < fns.length; i++) {
153
			byte[] src = this.readTmpFile(fns[i]);
154
			src = JpgUtil.read(src);
155
			byte[] shareResImage = this.resImage(src, this.resImageMaxLen);
156
			IoUtil.saveStream(new FileOutputStream(new File(this.resourceDataPath + "/" + this.createDate(), resourceId + "_" + i+1 + "." + JPG)), src, true);
157
			IoUtil.saveStream(new FileOutputStream(new File(this.resourceDataPath + "/" + this.createDate(), resourceId + "_" + i+1 + "_s." + JPG)), shareResImage, true);
158
			Image image = new Image();
159
			String imageId = StringUtil.buildUUID();
160
			image.setImageId(imageId);
161
			image.setSort(i+1);
162
			String imageSrc = this.createDate() + "/" + resourceId + "_" + i+1 + "." + JPG;
163
			image.setImageSrc(imageSrc);
164
			image.setResourceId(resourceId);
165
			this.imageDao.insert(con, image);
166
		}
167
	}
168
	
122 169
	@Post
123 170
	@Path("/saveResImg")
124 171
	public String insertResourceImg(@JdbcConn(true) Connection con, String resourceId, String base64, Integer angle) throws SQLException, IOException {

+ 17 - 2
src/main/java/com/ekexiu/portal/service/OrgService.java

@ -107,12 +107,27 @@ public class OrgService {
107 107
	}
108 108
	@Get
109 109
	@Path("/lq")
110
	public List<Organization> query(@JdbcConn Connection con ,@Nullable String name,@DefaultValue("5") int rows) throws SQLException
111
	{
110
	public List<Organization> query(@JdbcConn Connection con,@Nullable String name,@DefaultValue("5") int rows) throws SQLException{
112 111
		if(name==null) name = "%";
113 112
		else name="%"+name+"%";
114 113
		return this.orgDao.limitQuery(con, name, rows);
115 114
	}
115
	
116
	@Get
117
	@Path("/querylimit")
118
	public List<EditOrganization> queryLimit(@JdbcConn Connection con,@Nullable String name,@DefaultValue("3") int rows)throws SQLException{
119
		if(name != null){
120
			name = "%" + name + "%";
121
		}
122
		List<EditOrganization> organizations = this.orgDao.queryLimit(con, name, rows);
123
		if(!organizations.isEmpty()){
124
			for (EditOrganization organization : organizations) {
125
				organization.setHasOrgLogo(this.imageService.hasOrgLogo(organization.getId()));
126
			}
127
		}
128
		return organizations;
129
	}
130
	
116 131
	public String createOrganization(Connection con, String orgName) throws SQLException, IOException {
117 132
		String id = StringUtil.buildUUID();
118 133
		Organization org = new Organization();

+ 13 - 0
src/main/java/com/ekexiu/portal/service/ProfessorService.java

@ -342,6 +342,19 @@ public class ProfessorService {
342 342
		return professor;
343 343
	}
344 344
	
345
	@Get
346
	@Path("/qaByName")
347
	public List<EditProfessor> queryByName(@JdbcConn Connection con,@Nullable String name,@DefaultValue("3") int total)throws SQLException {
348
		if(name != null){
349
			name = "%" + name + "%";
350
		}
351
		List<EditProfessor> professors = this.professorDao.queryByName(con, name, total);
352
		for (EditProfessor professor : professors) {
353
			professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
354
		}
355
		return professors;
356
	}
357
	
345 358
	@Get
346 359
	@Path("/editBaseInfo/{id}")
347 360
	public EditProfessor queryEditBaseInfo(@JdbcConn Connection con, @PathVar String id) throws SQLException {

+ 136 - 1
src/main/java/com/ekexiu/portal/service/ResourceService.java

@ -3,6 +3,8 @@ package com.ekexiu.portal.service;
3 3
import java.io.IOException;
4 4
import java.sql.Connection;
5 5
import java.sql.SQLException;
6
import java.text.SimpleDateFormat;
7
import java.util.Date;
6 8
import java.util.List;
7 9

8 10
import org.jfw.apt.annotation.Autowrie;
@ -29,6 +31,7 @@ import com.ekexiu.portal.pojo.EditProfessor;
29 31

30 32
@Path("/resource")
31 33
public class ResourceService {
34
	private String timeFormat = "yyyyMMddHHmmss";
32 35
	@Autowrie
33 36
	private ProfessorDao professorDao;
34 37
	@Autowrie
@ -46,6 +49,14 @@ public class ResourceService {
46 49
	@Autowrie
47 50
	private GrowthLogService growthLogService;
48 51

52
	public String getTimeFormat() {
53
		return timeFormat;
54
	}
55

56
	public void setTimeFormat(String timeFormat) {
57
		this.timeFormat = timeFormat;
58
	}
59

49 60
	public ProfessorDao getProfessorDao() {
50 61
		return professorDao;
51 62
	}
@ -109,6 +120,12 @@ public class ResourceService {
109 120
	public void setGrowthLogService(GrowthLogService growthLogService) {
110 121
		this.growthLogService = growthLogService;
111 122
	}
123
	
124
	private String publishTime(){
125
		SimpleDateFormat df = new SimpleDateFormat(this.timeFormat);
126
		String publishTime = df.format(new Date());
127
		return publishTime;
128
	}
112 129

113 130
	@Post
114 131
	@Path
@ -124,6 +141,93 @@ public class ResourceService {
124 141
		return resourceId;
125 142
	}
126 143
	
144
	@Post
145
	@Path("/save")
146
	public String save(@JdbcConn(true) Connection con, Resource resource, @Nullable String[] fns) 
147
			throws JfwBaseException, SQLException, IOException {
148
		if(resource.getResourceId() == null){
149
			String resourceId = StringUtil.buildUUID();
150
			if(fns != null){
151
				this.imagesService.saveImg(con, resourceId, fns);
152
			}
153
			resource.setResourceId(resourceId);
154
			resource.setStatus("1");
155
			resource.setPublishTime(this.publishTime());
156
			this.resourceDao.insert(con, resource);
157
			//this.growthLogService.addResource(con, resource.getProfessorId());
158
			return resourceId;
159
		}else if(resource.getResourceId().trim().length() == 32){
160
			if(fns != null){
161
				this.imageDao.deleteRes(con, resource.getResourceId());
162
				this.imagesService.saveImg(con, resource.getResourceId(), fns);
163
			}
164
			this.resourceDao.update(con, resource);
165
			this.resourceDao.updatePublishTime(con, resource.getResourceId(), "1", this.publishTime());
166
			return resource.getResourceId();
167
		}else{
168
			throw new JfwBaseException(-1, "bad parameter:resourceId");
169
		}
170
	}
171
	
172
	@Post
173
	@Path("/draft")
174
	public String draft(@JdbcConn(true) Connection con, Resource resource, @Nullable String[] fns) 
175
			throws SQLException, IOException, JfwBaseException{
176
		if(resource.getResourceId() == null){
177
			String resourceId = StringUtil.buildUUID();
178
			if(fns != null){
179
				this.imagesService.saveImg(con, resourceId, fns);
180
			}
181
			resource.setResourceId(resourceId);
182
			resource.setStatus("0");
183
			this.resourceDao.insert(con, resource);
184
			return resourceId;
185
		}else if(resource.getResourceId().trim().length() == 32){
186
			if(fns != null){
187
				this.imageDao.deleteRes(con, resource.getResourceId());
188
				this.imagesService.saveImg(con, resource.getResourceId(), fns);
189
			}
190
			this.resourceDao.update(con, resource);
191
			this.resourceDao.updateStatus(con, resource.getResourceId(), "0");
192
			return resource.getResourceId();
193
		}else{
194
			throw new JfwBaseException(-1, "bad parameter:resourceId");
195
		}
196
	}
197
	
198
	@Post
199
	@Path("/timing")
200
	public String timing(@JdbcConn(true) Connection con, Resource resource, @Nullable String[] fns) 
201
			throws SQLException, IOException, JfwBaseException{
202
		if(resource.getResourceId() == null){
203
			String resourceId = StringUtil.buildUUID();
204
			if(fns != null){
205
				this.imagesService.saveImg(con, resourceId, fns);
206
			}
207
			resource.setResourceId(resourceId);
208
			resource.setStatus("2");
209
			this.resourceDao.insert(con, resource);
210
			return resourceId;
211
		}else if(resource.getResourceId().trim().length() == 32){
212
			if(fns != null){
213
				this.imageDao.deleteRes(con, resource.getResourceId());
214
				this.imagesService.saveImg(con, resource.getResourceId(), fns);
215
			}
216
			this.resourceDao.update(con, resource);
217
			this.resourceDao.updatePublishTime(con, resource.getResourceId(), "2", resource.getPublishTime());
218
			return resource.getResourceId();
219
		}else{
220
			throw new JfwBaseException(-1, "bad parameter:resourceId");
221
		}
222
	}
223
	
224
	@Post
225
	@Path("/delete")
226
	public void deleteRes(@JdbcConn(true) Connection con, String resourceId) throws SQLException{
227
		//修改资源状态为删除
228
		this.resourceDao.updateStatus(con, resourceId, "3");
229
	}
230
	
127 231
	@Post
128 232
	@Path("/saveRes")
129 233
	public String insertRes(@JdbcConn(true) Connection con, Resource resource, @Nullable String base64, Integer angle) 
@ -147,7 +251,7 @@ public class ResourceService {
147 251
		}
148 252
		this.resourceDao.update(con, resource);
149 253
	}
150

254
	
151 255
	@Get
152 256
	@Path("/{resourceId}")
153 257
	public Resource query(@JdbcConn Connection con, @PathVar String resourceId) throws SQLException {
@ -158,6 +262,21 @@ public class ResourceService {
158 262
		return resource;
159 263
	}
160 264
	
265
	@Get
266
	@Path("/queryOne")
267
	public Resource queryOne(@JdbcConn Connection con, String resourceId) throws SQLException {
268
		Resource resource = this.resourceDao.queryOne(con, resourceId);
269
		if(resource != null){
270
			resource.setImages(this.imageDao.queryRes(con, resourceId));
271
			EditProfessor professor = this.professorDao.queryBaseInfo(con, resource.getProfessorId());
272
			if(professor != null){
273
				professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
274
			}
275
			resource.setEditProfessor(professor);
276
		}
277
		return resource;
278
	}
279
	
161 280
	@Get
162 281
	@Path("/resourceInfo")
163 282
	public Resource queryInfo(@JdbcConn Connection con, String resourceId) throws SQLException {
@ -185,6 +304,22 @@ public class ResourceService {
185 304
		return queryResult;
186 305
	}
187 306
	
307
	@Get
308
	@Path("/qaByName")
309
	public List<Resource> queryByName(@JdbcConn Connection con, @Nullable String resourceName, @DefaultValue("3") int rows) throws SQLException {
310
		if(resourceName != null){
311
			resourceName = "%" + resourceName + "%";
312
		}
313
		List<Resource> resources = this.resourceDao.queryByName(con, resourceName, rows);
314
		if(!resources.isEmpty()){
315
			for (Resource resource : resources) {
316
				resource.setImages(this.imageDao.queryRes(con, resource.getResourceId()));
317
				resource.setProfessor(this.professorDao.queryOne(con, resource.getProfessorId()));
318
			}
319
		}
320
		return resources;
321
	}
322
	
188 323
	@Get
189 324
	@Path("/qapro")
190 325
	public List<Resource> queryPro(@JdbcConn Connection con, String professorId) throws SQLException {

+ 1 - 0
src/main/resources/project-test-dev.properties

@ -142,6 +142,7 @@ com_ekexiu_portal_service_AccessoryService.accessoryPath::java.io.File=/kexiu/ww
142 142
com_ekexiu_portal_service_ImagesService.tmpPath::java.io.File=/kexiu/www/html1/images/tmp
143 143
#资源图片保存目录
144 144
com_ekexiu_portal_service_ImagesService.resourcePath::java.io.File=/kexiu/www/html1/images/resource
145
com_ekexiu_portal_service_ImagesService.resourceDataPath::java.io.File=/kexiu/webdata1/data/resource
145 146
#科研文章图片上传临时目录
146 147
com_ekexiu_portal_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html1/images/tmp
147 148
#科研文章图片保存目录

+ 1 - 0
src/main/resources/project-test.properties

@ -142,6 +142,7 @@ com_ekexiu_portal_service_AccessoryService.accessoryPath::java.io.File=/kexiu/ww
142 142
com_ekexiu_portal_service_ImagesService.tmpPath::java.io.File=/kexiu/www/html/images/tmp
143 143
#资源图片保存目录
144 144
com_ekexiu_portal_service_ImagesService.resourcePath::java.io.File=/kexiu/www/html/images/resource
145
com_ekexiu_portal_service_ImagesService.resourceDataPath::java.io.File=/kexiu/webdata/data/resource
145 146
#科研文章图片上传临时目录
146 147
com_ekexiu_portal_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html/images/tmp
147 148
#科研文章图片保存目录

+ 1 - 0
src/main/resources/project.properties

@ -142,6 +142,7 @@ com_ekexiu_portal_service_AccessoryService.accessoryPath::java.io.File=/kexiu/ww
142 142
com_ekexiu_portal_service_ImagesService.tmpPath::java.io.File=/kexiu/www/html/images/tmp
143 143
#资源图片保存目录
144 144
com_ekexiu_portal_service_ImagesService.resourcePath::java.io.File=/kexiu/www/html/images/resource
145
com_ekexiu_portal_service_ImagesService.resourceDataPath::java.io.File=/kexiu/webdata/data/resource
145 146
#科研文章图片上传临时目录
146 147
com_ekexiu_portal_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html/images/tmp
147 148
#科研文章图片保存目录