All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ajaxjs.framework.BaseMapController Maven / Gradle / Ivy

Go to download

AJAXJS aims to full-stack, not only the server-side framework, but also integrates the front-end library. It'€™s written in HTML5 + Java, a successor to the JVM platform, efficient, secure, stable, cross-platform and many other advantages, but it abandoned the traditional enterprise architecture brought about by the large and bloated, emphasizing the lightweight, and fast, very suitable for the Internet fast application.

The newest version!
package com.ajaxjs.framework;

import com.ajaxjs.framework.filter.DataBaseFilter;
import com.ajaxjs.sql.orm.IBaseService;
import com.ajaxjs.web.mvc.MvcRequest;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 为方便 Map 提供的控制器
 * 
 * @author Frank Cheung
 *
 */
public abstract class BaseMapController extends BaseController {
	/**
	 * 必须提供一个 Service 对象
	 * 
	 * @return Service 对象
	 */
	public abstract IBaseService> getService();

	@ResponseBody
	@DataBaseFilter
	@PostMapping(produces = JSON)
	public String create(@RequestParam Map entity) {
		return create(getService(), entity);
	}

	@ResponseBody
	@DataBaseFilter
	@PutMapping(value = ID_INFO, produces = JSON)
	public String update(@PathVariable(ID) Long id, HttpServletRequest _req) {
		MvcRequest req = (MvcRequest) _req; // spring mvc 不支持 put form data
		Map entity = req.getPutRequestData();

		return update(getService(), id, entity);
	}

	@ResponseBody
	@DataBaseFilter
	@DeleteMapping(value = ID_INFO, produces = JSON)
	public String delete(@PathVariable(ID) Long id) {
		return delete(getService(), id);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy