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

org.eweb4j.solidbase.role.web.RemoveRoleMenuRelationAction Maven / Gradle / Ivy

The newest version!
package org.eweb4j.solidbase.role.web;

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

import javax.ws.rs.DELETE;
import javax.ws.rs.Path;

import org.eweb4j.component.dwz.DWZCons;
import org.eweb4j.solidbase.role.model.RoleException;
import org.eweb4j.util.JsonConverter;
import org.eweb4j.util.StringUtil;

@Path("${RoleConstant.MODEL_NAME}")
public class RemoveRoleMenuRelationAction extends BaseAction {

	private long roleId;
	private long[] treeMenuIds;
	private long[] navMenuIds;

	@Path("/role-menu/remove")
	@DELETE
	public String doRemoveRoleMenuRelation(Map model) {

		try {
			service.deleteRoleMenuRelation(roleId, treeMenuIds, navMenuIds);

			Map success = new HashMap();
			success.put("status", "true");
			success.put("message", "删除权限成功");

			return JsonConverter.convert(success);
		} catch (RoleException e) {
			model.put(DWZCons.ERROR_ATTR_NAME(), StringUtil.getExceptionString(e));

			Map fail = new HashMap();
			fail.put("status", "false");
			fail.put("message", "删除权限失败!原因:" + e.toString());

			return JsonConverter.convert(fail);
		}
	}

	public void setRoleId(long roleId) {
		this.roleId = roleId;
	}

	public void setTreeMenuIds(long[] treeMenuIds) {
		this.treeMenuIds = treeMenuIds;
	}

	public void setNavMenuIds(long[] navMenuIds) {
		this.navMenuIds = navMenuIds;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy