瀏覽代碼

修改资源更新时不能和资源图片同时更新的。接口改为post方式:ajax/resource/updateResource

zzy.zhiyuan.foxmail 8 年之前
父節點
當前提交
60f9a9c5ad
共有 1 個文件被更改,包括 6 次插入13 次删除
  1. 6 13
      src/main/java/com/ekexiu/portal/service/ResourceService.java

+ 6 - 13
src/main/java/com/ekexiu/portal/service/ResourceService.java

12
import org.jfw.apt.web.annotation.operate.Delete;
12
import org.jfw.apt.web.annotation.operate.Delete;
13
import org.jfw.apt.web.annotation.operate.Get;
13
import org.jfw.apt.web.annotation.operate.Get;
14
import org.jfw.apt.web.annotation.operate.Post;
14
import org.jfw.apt.web.annotation.operate.Post;
15
import org.jfw.apt.web.annotation.operate.Put;
16
import org.jfw.apt.web.annotation.param.JdbcConn;
15
import org.jfw.apt.web.annotation.param.JdbcConn;
17
import org.jfw.apt.web.annotation.param.PathVar;
16
import org.jfw.apt.web.annotation.param.PathVar;
18
import org.jfw.apt.web.annotation.param.RequestBody;
19
import org.jfw.util.PageQueryResult;
17
import org.jfw.util.PageQueryResult;
20
import org.jfw.util.StringUtil;
18
import org.jfw.util.StringUtil;
21

19

77
		return resourceId;
75
		return resourceId;
78
	}
76
	}
79

77

80
	@Put
81
	@Path
82
	public void update(@JdbcConn(true) Connection con, @RequestBody Resource resource, @Nullable String fn) throws SQLException {
83
		try {
84
			if(null != fn){
85
				this.imagesService.insert(con, resource.getResourceId(), fn);
86
			}
87
			this.resourceDao.update(con, resource);
88
		} catch (IOException e) {
89
			con.rollback();
90
			e.printStackTrace();
78
	@Post
79
	@Path("/updateResource")
80
	public void update(@JdbcConn(true) Connection con, Resource resource, @Nullable String fn) throws SQLException, IOException {
81
		if(null != fn){
82
			this.imagesService.insert(con, resource.getResourceId(), fn);
91
		}
83
		}
84
		this.resourceDao.update(con, resource);
92
	}
85
	}
93

86

94
	@Get
87
	@Get