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

com.ajaxjs.website.controller.DataDictController 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.website.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ajaxjs.framework.BaseMapController;
import com.ajaxjs.framework.QueryTools;
import com.ajaxjs.framework.filter.DataBaseFilter;
import com.ajaxjs.sql.orm.IBaseService;
import com.ajaxjs.website.service.DataDictService;

/**
 * 数据字典
 * 
 * @author sp42 [email protected]
 * 
 */
@Controller
@RequestMapping("/admin/entity/datadict/")
public class DataDictController extends BaseMapController {
	@Autowired
	private DataDictService service;

	@GetMapping
	public String get(ModelMap mv) {
		// Constant.DataDict.class
		try {
			// TODO
//				Class clz = ComponentMgr.get("DataDictClass", Class.class);
//				System.out.println(ReflectUtil.getConstantsInt(clz));
//
//				if (clz != null)
//					mv.put("DataDicts", ReflectUtil.getConstantsInt(clz));
		} catch (Throwable e) {
			e.printStackTrace();
			// 忽略
		}

		prepareData(mv, service);

		return "entity/data-dict";
	}

	@ResponseBody
	@GetMapping(value = "json", produces = JSON)
	@DataBaseFilter
	public String json(int tid, ModelMap mv) {
		if (tid == 0)
			throw new IllegalArgumentException("没有 tid 参数!");

		return toJson(DataDictService.dao.findList(QueryTools.by("tid", tid)));
	}

//	@POST
//	@Produces(MediaType.APPLICATION_JSON)
//	@MvcFilter(filters = DataBaseFilter.class)
//	public String save(@NotNull @QueryParam("json") String json) {
//		List> list = JsonHelper.parseList(json);
//
//		list.forEach(map -> {
//			if (service.update(map) > 0) {
//
//			}
//		});
//
//		return jsonOk("更新成功!");
//	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy