Browse Source

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

zzy.zhiyuan.foxmail 8 years ago
parent
commit
60f9a9c5ad
1 changed files with 6 additions and 13 deletions
  1. 6 13
      src/main/java/com/ekexiu/portal/service/ResourceService.java

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

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

@ -77,18 +75,13 @@ public class ResourceService {
77 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 87
	@Get