com.ajaxjs.cms.app.catelog.CatelogAdminController Maven / Gradle / Ivy
The newest version!
package com.ajaxjs.cms.app.catelog;
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;
@Path("/admin/catelog")
@Bean("CatelogAdminController")
public class CatelogAdminController extends BaseController {
@Resource("CatelogService")
private CatelogService service;
@GET
@Path("list")
@Produces(MediaType.APPLICATION_JSON)
@MvcFilter(filters = DataBaseFilter.class)
public String list() {
return toJson(service.getDao().findList());
}
@GET
@Override
public String createUI(ModelAndView model) {
prepareData(model);
return editUI_CMS();
}
@GET
@Path("getListAndSubByParentId")
@MvcFilter(filters = DataBaseFilter.class)
@Produces(MediaType.APPLICATION_JSON)
public String getListAndSubByParentId(@QueryParam("parentId") int parentId) {
return toJson(service.getAllListByParentId(parentId));
}
@Override
public String editUI(Long id, ModelAndView model) {
return show405;
}
@POST
@MvcFilter(filters = DataBaseFilter.class)
@Produces(MediaType.APPLICATION_JSON)
@Override
public String create(Catelog entity) {
return super.create(entity);
}
@PUT
@Path("/{id}")
@MvcFilter(filters = DataBaseFilter.class)
@Produces(MediaType.APPLICATION_JSON)
@Override
public String update(@PathParam("id") Long id, Catelog entity) {
return super.update(id, entity);
}
@DELETE
@Path("{id}")
@MvcFilter(filters = DataBaseFilter.class)
@Produces(MediaType.APPLICATION_JSON)
public String delete(@PathParam("id") Long id) {
return delete(id, new Catelog());
}
@Override
public IBaseService getService() {
return service;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy