You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
970 B
31 lines
970 B
package web.controller;
|
|
|
|
import core.service.BaseService;
|
|
import core.util.DBAction;
|
|
import db.model.AbstractModel;
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
/**
|
|
* Created by reborn on 2017/9/14.
|
|
*/
|
|
public class BaseController<T extends AbstractModel>{
|
|
protected Logger log=LogManager.getLogger();
|
|
|
|
@Resource
|
|
public BaseService baseService;
|
|
|
|
@ResponseBody
|
|
@RequestMapping(value = "{action}", produces = "application/json;charset=UTF-8")
|
|
public String curd(@PathVariable DBAction action, T model) {
|
|
log.info((model.tableNote()==null?model.getClass():model.tableNote()) + "进行" + action.getCh() + "操作请求");
|
|
return baseService.curd(action, model);
|
|
}
|
|
|
|
|
|
}
|
|
|