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

META-INF.resources.WEB-INF.jsp.cms.code-generator.controller.jsp Maven / Gradle / Ivy

The newest version!
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>package ${packageName}.controller;


import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import com.ajaxjs.framework.BaseController;
import com.ajaxjs.framework.IBaseService;
import com.ajaxjs.ioc.Bean;
import com.ajaxjs.ioc.Resource;
import com.ajaxjs.mvc.ModelAndView;
import com.ajaxjs.mvc.filter.DataBaseFilter;
import com.ajaxjs.mvc.filter.MvcFilter;
import ${packageName}.service.${beanName}Service;
import ${packageName}.model.${beanName};

/**
 * 
 * 控制器
 */
@Bean
@Path("/admin/${beanName}")
public class ${beanName}AdminController extends BaseController<${beanName}> {
	@Resource("${beanName}Service")
	private ${beanName}Service service;

	@GET
	@Path("/list")
	@MvcFilter(filters = DataBaseFilter.class)
	public String list(@QueryParam("start") int start, @QueryParam("limit") int limit, ModelAndView mv) {
		listPaged(start, limit, mv);
		return adminList();
	}

	@GET
	@MvcFilter(filters = DataBaseFilter.class)
	@Path("/{id}")
	@Override
	public String editUI(@PathParam("id") Long id, ModelAndView mv) {
		super.editUI(id, mv);
		return editUI();
	}
	
	@GET
	@Override
	public String createUI(ModelAndView mv) {
		super.createUI(mv);
		return editUI();
	}

	@POST
	@MvcFilter(filters = DataBaseFilter.class)
	@Produces(MediaType.APPLICATION_JSON)
	@Override
	public String create(${beanName} entity) {
		return super.create(entity);
	}

	@PUT
	@MvcFilter(filters = DataBaseFilter.class)
	@Path("{id}")
	@Produces(MediaType.APPLICATION_JSON)
	@Override
	public String update(@PathParam("id") Long id, ${beanName} entity) {
		return super.update(id, entity);
	}

	@DELETE
	@MvcFilter(filters = DataBaseFilter.class)
	@Path("{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public String delete(@PathParam("id") Long id) {
		return delete(id, new ${beanName}());
	}
	
	@Override
	public IBaseService<${beanName}> getService() {
		return service;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy