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

com.ajaxjs.cms.controller.DataDictAdminController Maven / Gradle / Ivy

The newest version!
package com.ajaxjs.cms.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

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.core.MediaType;

import com.ajaxjs.cms.DataDictService;
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;

@Bean
@Path("/admin/DataDict")
public class DataDictAdminController extends BaseController> {
	@Resource("DataDictService")
	private DataDictService service;

	@GET
	@Path("list")
	@Produces(MediaType.APPLICATION_JSON)
	@MvcFilter(filters = DataBaseFilter.class)
	public String list() {
		return toJson(service.getDao().findList());
	}

	@GET
	@Path("/getDictListByParentId/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	@MvcFilter(filters = DataBaseFilter.class)
	public List> getDictListByParentId(@PathParam("id") long pId) {
		return DataDictService.dao.findByParentId(pId);
	}

	@GET
	@Override
	public String createUI(ModelAndView mv) {
		super.createUI(mv);
		return editUI_CMS();
	}

	@Override
	public String editUI(@PathParam("id") Long id, ModelAndView mv) {
		return show405;
	}

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

	@PUT
	@MvcFilter(filters = DataBaseFilter.class)
	@Path("{id}")
	@Produces(MediaType.APPLICATION_JSON)
	@Override
	public String update(@PathParam("id") Long id, Map 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 HashMap());
	}

	@Override
	public IBaseService> getService() {
		return service;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy