jiapeng vor 7 Jahren
Ursprung
Commit
a484c2693c

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

1113
		}
1113
		}
1114
		return this.articleDao.lasterByPublishTime(con, time, rows);
1114
		return this.articleDao.lasterByPublishTime(con, time, rows);
1115
	}
1115
	}
1116
	@Path("/lq/ware")
1116
	@Path("/lq/byWare")
1117
	@Get
1117
	@Get
1118
	public List<Article> byWare(@JdbcConn Connection con,String ware,int rows) throws SQLException{
1118
	public List<Article> byWare(@JdbcConn Connection con,String ware,int rows) throws SQLException{
1119
		return articleDao.queryByWareId(con, ware, rows);
1119
		return articleDao.queryByWareId(con, ware, rows);

+ 7 - 1
src/main/java/com/ekexiu/portal/service/ProfessorService.java

354

354

355
	@Post
355
	@Post
356
	@Path("/org")
356
	@Path("/org")
357
	public boolean updateOrgid(@JdbcConn(true) Connection con, String id, String name) throws SQLException, IOException {
357
	public boolean updateOrgid(@JdbcConn(true) Connection con,final String id, String name) throws SQLException, IOException {
358
		Professor p = this.professorDao.query(con, id);
358
		Professor p = this.professorDao.query(con, id);
359
		if (p != null) {
359
		if (p != null) {
360
			String oid = this.orgService.createOrganization(con, name);
360
			String oid = this.orgService.createOrganization(con, name);
365
					this.professorDao.updateOrgAuth(con, id, "0");
365
					this.professorDao.updateOrgAuth(con, id, "0");
366
					this.demandDao.closeByCreator(con, id, id);
366
					this.demandDao.closeByCreator(con, id, id);
367
					this.orgResStaffDao.deletePro(con, id);
367
					this.orgResStaffDao.deletePro(con, id);
368
					JdbcUtil.execute(con,"DELETE FROM WARE_PRO WHERE PROFESSOR=?",new PreparedStatementConfig() {
369
						@Override
370
						public void config(PreparedStatement ps) throws SQLException {
371
							ps.setString(1, id);
372
						}
373
					});
368
				}
374
				}
369
				return true;
375
				return true;
370
			}
376
			}

+ 5 - 5
src/main/java/com/ekexiu/portal/ware/Ware.java

42
	 */
42
	 */
43
	private String owner;
43
	private String owner;
44
	
44
	
45
	private String imges;
45
	private String images;
46
	/**
46
	/**
47
	 * 状态  0:删除,1:发布的 ,2:草稿
47
	 * 状态  0:删除,1:发布的 ,2:草稿
48
	 */
48
	 */
126
		this.owner = owner;
126
		this.owner = owner;
127
	}
127
	}
128
	@Column(DE.Text_de)
128
	@Column(DE.Text_de)
129
	public String getImges() {
130
		return imges;
129
	public String getImages() {
130
		return images;
131
	}
131
	}
132
	public void setImges(String imges) {
133
		this.imges = imges;
132
	public void setImages(String images) {
133
		this.images = images;
134
	}
134
	}
135
	@Column(DE.singleChar)
135
	@Column(DE.singleChar)
136
	public String getState() {
136
	public String getState() {

+ 7 - 2
src/main/java/com/ekexiu/portal/ware/WareDao.java

145
	@OrderBy("ORDER BY MODIFY_TIME DESC")
145
	@OrderBy("ORDER BY MODIFY_TIME DESC")
146
	@Where("STATE='1'")
146
	@Where("STATE='1'")
147
	public abstract List<Ware> queryByResource(Connection con,@SqlColumn(handlerClass=StringHandler.class, value = { "ID IN (SELECT ID FROM WARE_RES WHERE RESOURCE=?)" }) String id,int rows)throws SQLException;
147
	public abstract List<Ware> queryByResource(Connection con,@SqlColumn(handlerClass=StringHandler.class, value = { "ID IN (SELECT ID FROM WARE_RES WHERE RESOURCE=?)" }) String id,int rows)throws SQLException;
148
	@LimitSelect
149
	@OrderBy("ORDER BY MODIFY_TIME DESC")
150
	@Where("STATE='1'")
151
	public abstract List<Ware> queryByArticle(Connection con,@SqlColumn(handlerClass=StringHandler.class, value = { "ID IN (SELECT WARE FROM ARTICLE_WARE WHERE ID=?)" }) String id,int rows) throws SQLException;
152
	
148
	
153
	
149
	public List<Ware> indexSeach(Connection con, String key, long sortFirst, String modifyTime, String id, int rows) throws SQLException {
154
	public List<Ware> indexSeach(Connection con, String key, long sortFirst, String modifyTime, String id, int rows) throws SQLException {
150
		List<Ware> result = new ArrayList<Ware>(rows);
155
		List<Ware> result = new ArrayList<Ware>(rows);
151
		StringBuilder sb = new StringBuilder();
156
		StringBuilder sb = new StringBuilder();
152
		sb.append("SELECT PAGE_VIEWS,ID,NAME,KEYWORDS,CNT,COOPERATION,DESCP,CATEGORY,OWNER,IMGES,STATE,SHARE_ID,SORT_FIRST,CREATE_TIME,MODIFY_TIME FROM WARE")
157
		sb.append("SELECT PAGE_VIEWS,ID,NAME,KEYWORDS,CNT,COOPERATION,DESCP,CATEGORY,OWNER,IMAGES,STATE,SHARE_ID,SORT_FIRST,CREATE_TIME,MODIFY_TIME FROM WARE")
153
				.append(" WHERE STATE='1' AND ((SORT_FIRST<?) OR (SORT_FIRST=? AND MODIFY_TIME < ?) OR ( SORT_FIRST=? AND MODIFY_TIME = ? AND ID < ?)");
158
				.append(" WHERE STATE='1' AND ((SORT_FIRST<?) OR (SORT_FIRST=? AND MODIFY_TIME < ?) OR ( SORT_FIRST=? AND MODIFY_TIME = ? AND ID < ?)");
154
		if (key != null) {
159
		if (key != null) {
155
			sb.append(" AND (NAME LIKE ? OR CNT LIKE ? OR KEYWORDS LIKE ?  OR(CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?))")
160
			sb.append(" AND (NAME LIKE ? OR CNT LIKE ? OR KEYWORDS LIKE ?  OR(CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?))")
207
					if (rs.wasNull()) {
212
					if (rs.wasNull()) {
208
						_m_7 = null;
213
						_m_7 = null;
209
					}
214
					}
210
					_obj.setImges(_m_7);
215
					_obj.setImages(_m_7);
211
					_obj.setState(rs.getString(11));
216
					_obj.setState(rs.getString(11));
212
					_obj.setShareId(rs.getLong(12));
217
					_obj.setShareId(rs.getLong(12));
213
					_obj.setSortFirst(rs.getLong(13));
218
					_obj.setSortFirst(rs.getLong(13));

+ 21 - 15
src/main/java/com/ekexiu/portal/ware/WareService.java

156
		String id = StringUtil.buildUUID();
156
		String id = StringUtil.buildUUID();
157
		ware.setId(id);
157
		ware.setId(id);
158
		wareDao.insert(con, ware);
158
		wareDao.insert(con, ware);
159
		this.saveSmallImg(ware.getImges());
159
		this.saveSmallImg(ware.getImages());
160
		String[] kws = null;
160
		String[] kws = null;
161
		if (ware.getKeywords() != null) {
161
		if (ware.getKeywords() != null) {
162
			kws = ListUtil.splitTrimExcludeEmpty(ware.getKeywords(), ',').toArray(new String[0]);
162
			kws = ListUtil.splitTrimExcludeEmpty(ware.getKeywords(), ',').toArray(new String[0]);
186
	public boolean update(Connection con, Ware ware, String[] professor, String[] resource) throws SQLException, IOException {
186
	public boolean update(Connection con, Ware ware, String[] professor, String[] resource) throws SQLException, IOException {
187
		String id = ware.getId();
187
		String id = ware.getId();
188
		if (wareDao.update(con, ware) > 0) {
188
		if (wareDao.update(con, ware) > 0) {
189
			this.saveSmallImg(ware.getImges());
189
			this.saveSmallImg(ware.getImages());
190
			String[] kws = null;
190
			String[] kws = null;
191
			if (ware.getKeywords() != null) {
191
			if (ware.getKeywords() != null) {
192
				kws = ListUtil.splitTrimExcludeEmpty(ware.getKeywords(), ',').toArray(new String[0]);
192
				kws = ListUtil.splitTrimExcludeEmpty(ware.getKeywords(), ',').toArray(new String[0]);
231
	 */
231
	 */
232
	@Post
232
	@Post
233
	@Path("/draft")
233
	@Path("/draft")
234
	public String draft(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime", "publishTime",
234
	public String draft(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime", 
235
			"shareId", "pageViews", "sortFirst" }) Ware ware, @Nullable String[] resource) throws SQLException, IOException {
235
			"shareId", "pageViews", "sortFirst" }) Ware ware, @Nullable String[] resource) throws SQLException, IOException {
236
		ware.setState("2");
236
		ware.setState("2");
237
		ware.setCategory("1");
237
		ware.setCategory("1");
251
	 */
251
	 */
252
	@Post
252
	@Post
253
	@Path("/draft/org")
253
	@Path("/draft/org")
254
	public String draft(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime", "publishTime",
254
	public String draft(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime", 
255
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
255
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
256
		ware.setState("2");
256
		ware.setState("2");
257
		ware.setCategory("2");
257
		ware.setCategory("2");
270
	 */
270
	 */
271
	@Post
271
	@Post
272
	@Path("/publish")
272
	@Path("/publish")
273
	public String publish(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime", "publishTime",
273
	public String publish(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime", 
274
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource) throws SQLException, IOException {
274
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource) throws SQLException, IOException {
275
		ware.setState("1");
275
		ware.setState("1");
276
		ware.setCategory("1");
276
		ware.setCategory("1");
290
	 */
290
	 */
291
	@Post
291
	@Post
292
	@Path("/publish/org")
292
	@Path("/publish/org")
293
	public String publish(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime", "publishTime",
293
	public String publish(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime", 
294
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
294
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
295
		ware.setState("1");
295
		ware.setState("1");
296
		ware.setCategory("2");
296
		ware.setCategory("2");
309
	 */
309
	 */
310
	@Post
310
	@Post
311
	@Path("/draft/update")
311
	@Path("/draft/update")
312
	public boolean updateDraft(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime",
313
			"publishTime", "shareId", "pageViews", "sortFirst" }) Ware ware, @Nullable String[] resource) throws SQLException, IOException {
312
	public boolean updateDraft(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "state", "createTime", "modifyTime",
313
			"shareId", "pageViews", "sortFirst" }) Ware ware, @Nullable String[] resource) throws SQLException, IOException {
314
		ware.setState("2");
314
		ware.setState("2");
315
		ware.setCategory("1");
315
		ware.setCategory("1");
316
		return update(con, ware, null, resource);
316
		return update(con, ware, null, resource);
329
	 */
329
	 */
330
	@Post
330
	@Post
331
	@Path("/draft/org/update")
331
	@Path("/draft/org/update")
332
	public boolean updateDraft(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime",
333
			"publishTime", "shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
332
	public boolean updateDraft(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "state", "createTime", "modifyTime",
333
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
334
		ware.setState("2");
334
		ware.setState("2");
335
		ware.setCategory("2");
335
		ware.setCategory("2");
336
		return update(con, ware, professor, resource);
336
		return update(con, ware, professor, resource);
348
	 */
348
	 */
349
	@Post
349
	@Post
350
	@Path("/publish/update")
350
	@Path("/publish/update")
351
	public String updatePublish(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime",
352
			"publishTime", "shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource) throws SQLException, IOException {
351
	public String updatePublish(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "state", "createTime", "modifyTime",
352
		 "shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource) throws SQLException, IOException {
353
		ware.setState("1");
353
		ware.setState("1");
354
		ware.setCategory("1");
354
		ware.setCategory("1");
355
		return insert(con, ware, null, resource);
355
		return insert(con, ware, null, resource);
368
	 */
368
	 */
369
	@Post
369
	@Post
370
	@Path("/publish/org/update")
370
	@Path("/publish/org/update")
371
	public String updatePublish(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "id", "state", "createTime", "modifyTime",
372
			"publishTime", "shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
371
	public String updatePublish(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "category", "state", "createTime", "modifyTime",
372
		"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
373
		ware.setState("1");
373
		ware.setState("1");
374
		ware.setCategory("2");
374
		ware.setCategory("2");
375
		return insert(con, ware, professor, resource);
375
		return insert(con, ware, professor, resource);
601
	}
601
	}
602

602

603
	@Get
603
	@Get
604
	@Path("/index/seach")
604
	@Path("/index/search")
605
	public List<Ware> indexSeach(@JdbcConn Connection con, @Nullable String key, @DefaultValue("Long.MAX_VALUE") long sortFirst,
605
	public List<Ware> indexSeach(@JdbcConn Connection con, @Nullable String key, @DefaultValue("Long.MAX_VALUE") long sortFirst,
606
			@DefaultValue("\"9\"") String time, @DefaultValue("\"G\"") String id, int rows) throws SQLException {
606
			@DefaultValue("\"9\"") String time, @DefaultValue("\"G\"") String id, int rows) throws SQLException {
607
		if (key != null) {
607
		if (key != null) {
642
	public List<Ware> queryByResourceWithModifyTime(@JdbcConn Connection con,String id,int rows) throws SQLException{
642
	public List<Ware> queryByResourceWithModifyTime(@JdbcConn Connection con,String id,int rows) throws SQLException{
643
		return wareDao.queryByResource(con, id, rows);
643
		return wareDao.queryByResource(con, id, rows);
644
	}
644
	}
645
	@Get
646
	@Path("/byArticle")
647
	public List<Ware> queryByArticle(@JdbcConn Connection con,String id,@DefaultValue("Integer.MAX_VALUE" ) int rows) throws SQLException{
648
		return wareDao.queryByArticle(con, id, rows);
649
	}
650
	
645
	//
651
	//
646
	// @Post
652
	// @Post
647
	// @Path("/update")
653
	// @Path("/update")

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

2241
	ID TEXT NOT NULL,
2241
	ID TEXT NOT NULL,
2242
	KW TEXT NOT NULL
2242
	KW TEXT NOT NULL
2243
);
2243
);
2244
COMMENT ON TABLE WARE_KEY_WORD is '服务关键词';
2244
COMMENT ON TABLE WRE_KEY_WORD is '服务关键词';
2245
CREATE TABLE WARE_PRO(
2245
CREATE TABLE WARE_PRO(
2246
	ID TEXT NOT NULL,
2246
	ID TEXT NOT NULL,
2247
	PROFESSOR TEXT NOT NULL
2247
	PROFESSOR TEXT NOT NULL
2257
	WARE TEXT NOT NULL
2257
	WARE TEXT NOT NULL
2258
);
2258
);
2259
COMMENT ON TABLE WARE is '文章关联服务表';
2259
COMMENT ON TABLE WARE is '文章关联服务表';
2260

2260
ALTER TABLE PPATENT ADD COLUMN COOPERATION text;
2261
COMMENT ON COLUMN PPATENT.COOPERATION is '合作备注';
2261

2262

2262

2263

2263

2264