jiapeng 7 years ago
parent
commit
39ae30366f

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

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

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

@ -354,7 +354,7 @@ public class ProfessorService {
354 354

355 355
	@Post
356 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 358
		Professor p = this.professorDao.query(con, id);
359 359
		if (p != null) {
360 360
			String oid = this.orgService.createOrganization(con, name);
@ -365,6 +365,12 @@ public class ProfessorService {
365 365
					this.professorDao.updateOrgAuth(con, id, "0");
366 366
					this.demandDao.closeByCreator(con, id, id);
367 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 375
				return true;
370 376
			}

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

@ -42,7 +42,7 @@ public class Ware implements CreateTimeSupported, ModifyTimeSupported{
42 42
	 */
43 43
	private String owner;
44 44
	
45
	private String imges;
45
	private String images;
46 46
	/**
47 47
	 * 状态  0:删除,1:发布的 ,2:草稿
48 48
	 */
@ -126,11 +126,11 @@ public class Ware implements CreateTimeSupported, ModifyTimeSupported{
126 126
		this.owner = owner;
127 127
	}
128 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 135
	@Column(DE.singleChar)
136 136
	public String getState() {

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

@ -145,11 +145,16 @@ public abstract class WareDao {
145 145
	@OrderBy("ORDER BY MODIFY_TIME DESC")
146 146
	@Where("STATE='1'")
147 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 154
	public List<Ware> indexSeach(Connection con, String key, long sortFirst, String modifyTime, String id, int rows) throws SQLException {
150 155
		List<Ware> result = new ArrayList<Ware>(rows);
151 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 158
				.append(" WHERE STATE='1' AND ((SORT_FIRST<?) OR (SORT_FIRST=? AND MODIFY_TIME < ?) OR ( SORT_FIRST=? AND MODIFY_TIME = ? AND ID < ?)");
154 159
		if (key != null) {
155 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,7 +212,7 @@ public abstract class WareDao {
207 212
					if (rs.wasNull()) {
208 213
						_m_7 = null;
209 214
					}
210
					_obj.setImges(_m_7);
215
					_obj.setImages(_m_7);
211 216
					_obj.setState(rs.getString(11));
212 217
					_obj.setShareId(rs.getLong(12));
213 218
					_obj.setSortFirst(rs.getLong(13));

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

@ -156,7 +156,7 @@ public class WareService {
156 156
		String id = StringUtil.buildUUID();
157 157
		ware.setId(id);
158 158
		wareDao.insert(con, ware);
159
		this.saveSmallImg(ware.getImges());
159
		this.saveSmallImg(ware.getImages());
160 160
		String[] kws = null;
161 161
		if (ware.getKeywords() != null) {
162 162
			kws = ListUtil.splitTrimExcludeEmpty(ware.getKeywords(), ',').toArray(new String[0]);
@ -186,7 +186,7 @@ public class WareService {
186 186
	public boolean update(Connection con, Ware ware, String[] professor, String[] resource) throws SQLException, IOException {
187 187
		String id = ware.getId();
188 188
		if (wareDao.update(con, ware) > 0) {
189
			this.saveSmallImg(ware.getImges());
189
			this.saveSmallImg(ware.getImages());
190 190
			String[] kws = null;
191 191
			if (ware.getKeywords() != null) {
192 192
				kws = ListUtil.splitTrimExcludeEmpty(ware.getKeywords(), ',').toArray(new String[0]);
@ -231,7 +231,7 @@ public class WareService {
231 231
	 */
232 232
	@Post
233 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 235
			"shareId", "pageViews", "sortFirst" }) Ware ware, @Nullable String[] resource) throws SQLException, IOException {
236 236
		ware.setState("2");
237 237
		ware.setCategory("1");
@ -251,7 +251,7 @@ public class WareService {
251 251
	 */
252 252
	@Post
253 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 255
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
256 256
		ware.setState("2");
257 257
		ware.setCategory("2");
@ -270,7 +270,7 @@ public class WareService {
270 270
	 */
271 271
	@Post
272 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 274
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource) throws SQLException, IOException {
275 275
		ware.setState("1");
276 276
		ware.setCategory("1");
@ -290,7 +290,7 @@ public class WareService {
290 290
	 */
291 291
	@Post
292 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 294
			"shareId", "pageViews", "sortFirst" }) Ware ware, String[] resource, String[] professor) throws SQLException, IOException {
295 295
		ware.setState("1");
296 296
		ware.setCategory("2");
@ -309,8 +309,8 @@ public class WareService {
309 309
	 */
310 310
	@Post
311 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 314
		ware.setState("2");
315 315
		ware.setCategory("1");
316 316
		return update(con, ware, null, resource);
@ -329,8 +329,8 @@ public class WareService {
329 329
	 */
330 330
	@Post
331 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 334
		ware.setState("2");
335 335
		ware.setCategory("2");
336 336
		return update(con, ware, professor, resource);
@ -348,8 +348,8 @@ public class WareService {
348 348
	 */
349 349
	@Post
350 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 353
		ware.setState("1");
354 354
		ware.setCategory("1");
355 355
		return insert(con, ware, null, resource);
@ -368,8 +368,8 @@ public class WareService {
368 368
	 */
369 369
	@Post
370 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 373
		ware.setState("1");
374 374
		ware.setCategory("2");
375 375
		return insert(con, ware, professor, resource);
@ -601,7 +601,7 @@ public class WareService {
601 601
	}
602 602

603 603
	@Get
604
	@Path("/index/seach")
604
	@Path("/index/search")
605 605
	public List<Ware> indexSeach(@JdbcConn Connection con, @Nullable String key, @DefaultValue("Long.MAX_VALUE") long sortFirst,
606 606
			@DefaultValue("\"9\"") String time, @DefaultValue("\"G\"") String id, int rows) throws SQLException {
607 607
		if (key != null) {
@ -642,6 +642,12 @@ public class WareService {
642 642
	public List<Ware> queryByResourceWithModifyTime(@JdbcConn Connection con,String id,int rows) throws SQLException{
643 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 652
	// @Post
647 653
	// @Path("/update")

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

@ -2241,7 +2241,7 @@ CREATE TABLE WRE_KEY_WORD(
2241 2241
	ID TEXT NOT NULL,
2242 2242
	KW TEXT NOT NULL
2243 2243
);
2244
COMMENT ON TABLE WARE_KEY_WORD is '服务关键词';
2244
COMMENT ON TABLE WRE_KEY_WORD is '服务关键词';
2245 2245
CREATE TABLE WARE_PRO(
2246 2246
	ID TEXT NOT NULL,
2247 2247
	PROFESSOR TEXT NOT NULL
@ -2257,7 +2257,8 @@ CREATE TABLE ARTICLE_WARE(
2257 2257
	WARE TEXT NOT NULL
2258 2258
);
2259 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