From 3928e7f4d60406ec9f3867f8ae7a72c63b90f2aa Mon Sep 17 00:00:00 2001
From: dearlin <1261008090@qq.com>
Date: Mon, 27 Nov 2023 09:39:23 +0800
Subject: [PATCH 1/2] =?UTF-8?q?add:=20=E5=88=86=E5=85=AC=E5=8F=B8=E7=B3=BB?=
 =?UTF-8?q?=E7=BB=9F=E7=AE=A1=E7=90=86=EF=BC=88=E8=8F=9C=E5=8D=95=E8=A7=92?=
 =?UTF-8?q?=E8=89=B2=E6=9D=83=E9=99=90=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../corpsystem/CorpMenuController.java        | 231 ++++++
 .../corpsystem/CorpRoleController.java        | 447 +++++++++++
 .../corpsystem/CorpUsersController.java       | 725 ++++++++++++++++++
 .../system/ButtonrightsController.java        |  39 +-
 .../controller/system/UsersController.java    |   1 -
 .../java/com/zcloud/entity/system/Role.java   |  10 +
 .../datasource/corpsystem/CorpMenuMapper.java |  62 ++
 .../datasource/corpsystem/CorpRoleMapper.java | 110 +++
 .../corpsystem/CorpUsersMapper.java           | 130 ++++
 .../system/corpsystem/CorpMenuService.java    |  75 ++
 .../system/corpsystem/CorpRoleService.java    |  94 +++
 .../system/corpsystem/CorpUsersService.java   | 133 ++++
 .../corpsystem/impl/CorpMenuServiceImpl.java  | 126 +++
 .../corpsystem/impl/CorpRoleServiceImpl.java  | 136 ++++
 .../corpsystem/impl/CorpUsersServiceImpl.java | 177 +++++
 src/main/java/com/zcloud/util/Const.java      |   2 +
 src/main/resources/application-dev.properties |   8 +-
 .../datasource/corpsystem/CorpMenuMapper.xml  | 146 ++++
 .../datasource/corpsystem/CorpRoleMapper.xml  | 199 +++++
 .../datasource/corpsystem/CorpUsersMapper.xml | 549 +++++++++++++
 20 files changed, 3381 insertions(+), 19 deletions(-)
 create mode 100644 src/main/java/com/zcloud/controller/corpsystem/CorpMenuController.java
 create mode 100644 src/main/java/com/zcloud/controller/corpsystem/CorpRoleController.java
 create mode 100644 src/main/java/com/zcloud/controller/corpsystem/CorpUsersController.java
 create mode 100644 src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpMenuMapper.java
 create mode 100644 src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpRoleMapper.java
 create mode 100644 src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpUsersMapper.java
 create mode 100644 src/main/java/com/zcloud/service/system/corpsystem/CorpMenuService.java
 create mode 100644 src/main/java/com/zcloud/service/system/corpsystem/CorpRoleService.java
 create mode 100644 src/main/java/com/zcloud/service/system/corpsystem/CorpUsersService.java
 create mode 100644 src/main/java/com/zcloud/service/system/corpsystem/impl/CorpMenuServiceImpl.java
 create mode 100644 src/main/java/com/zcloud/service/system/corpsystem/impl/CorpRoleServiceImpl.java
 create mode 100644 src/main/java/com/zcloud/service/system/corpsystem/impl/CorpUsersServiceImpl.java
 create mode 100644 src/main/resources/mybatis/datasource/corpsystem/CorpMenuMapper.xml
 create mode 100644 src/main/resources/mybatis/datasource/corpsystem/CorpRoleMapper.xml
 create mode 100644 src/main/resources/mybatis/datasource/corpsystem/CorpUsersMapper.xml

diff --git a/src/main/java/com/zcloud/controller/corpsystem/CorpMenuController.java b/src/main/java/com/zcloud/controller/corpsystem/CorpMenuController.java
new file mode 100644
index 00000000..093831c0
--- /dev/null
+++ b/src/main/java/com/zcloud/controller/corpsystem/CorpMenuController.java
@@ -0,0 +1,231 @@
+package com.zcloud.controller.corpsystem;
+
+import com.zcloud.controller.base.BaseController;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Menu;
+import com.zcloud.service.system.FHlogService;
+import com.zcloud.service.system.corpsystem.CorpMenuService;
+import com.zcloud.util.Const;
+import com.zcloud.util.Jurisdiction;
+import com.zcloud.util.RightsHelper;
+import com.zcloud.util.Tools;
+import net.sf.json.JSONArray;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 说明:菜单管理处理类
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+@Controller
+@RequestMapping("/corpMenu")
+public class CorpMenuController extends BaseController {
+
+	@Autowired
+    private CorpMenuService corpMenuService;
+	@Autowired
+    private FHlogService FHLOG;
+
+	/**
+	 * 菜单列表ztree(菜单管理)
+	 * @return
+	 */
+	@RequestMapping(value="/listAllMenu")
+	@ResponseBody
+	public Object listAllMenu()throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		JSONArray arr = JSONArray.fromObject(corpMenuService.listAllMenu("0"));
+		String json = arr.toString();
+		json = json.replaceAll("MENU_ID", "id").replaceAll("PARENT_ID", "pId").replaceAll("MENU_NAME", "name").replaceAll("subMenu", "nodes").replaceAll("hasMenu", "checked").replaceAll("MENU_URL", "url");
+		map.put("zTreeNodes", json);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 菜单列表
+	 * @return
+	 */
+	@RequestMapping(value="/list")
+	@ResponseBody
+	public Object list(String MENU_ID)throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		MENU_ID = Tools.isEmpty(MENU_ID)?"0":MENU_ID;
+		List<Menu> menuList = corpMenuService.listSubMenuByParentId(MENU_ID);
+		map.put("pd", corpMenuService.getMenuById(pd));									//传入父菜单所有信息
+		map.put("MSG", null == pd.get("MSG")?"'list'":pd.get("MSG").toString()); 	//MSG=change 则为编辑或删除后跳转过来的
+		map.put("menuList", menuList);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 请求新增菜单页面
+	 * @return
+	 */
+	@RequestMapping(value="/toAdd")
+	@ResponseBody
+	public Object toAdd()throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		String MENU_ID = (null == pd.get("MENU_ID") || "".equals(pd.get("MENU_ID").toString()))?"0":pd.get("MENU_ID").toString();//接收传过来的上级菜单ID,如果上级为顶级就取值“0”
+		pd.put("MENU_ID",MENU_ID);
+		map.put("pds", corpMenuService.getMenuById(pd));	//传入父菜单所有信息
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 新增菜单
+	 * @param menu
+	 * @return
+	 */
+	@RequestMapping(value="/add")
+	@ResponseBody
+	public Object add(Menu menu)throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		menu.setMENU_ID(String.valueOf(Integer.parseInt(corpMenuService.findMaxId(pd).get("MID").toString())+1));
+		menu.setMENU_ICON("");													//默认无菜单图标
+		corpMenuService.addMenu(menu); 												//新增菜单
+		FHLOG.save(Jurisdiction.getUsername(), "新增菜单:"+menu.getMENU_NAME());	//记录日志
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 请求编辑菜单页面
+	 * @param
+	 * @return
+	 */
+	@RequestMapping(value="/toEdit")
+	@ResponseBody
+	public Object toEdit(String MENU_ID)throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		pd = corpMenuService.getMenuById(pd);						//读取此ID的菜单数据
+		map.put("pd", pd);
+		pd.put("MENU_ID",pd.get("PARENT_ID").toString());		//用作读取父菜单信息
+		map.put("pds", corpMenuService.getMenuById(pd));			//传入父菜单所有信息
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 保存编辑
+	 * @param
+	 * @return
+	 */
+	@RequestMapping(value="/edit")
+	@ResponseBody
+	public Object edit(Menu menu)throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		corpMenuService.edit(menu);
+		FHLOG.save(Jurisdiction.getUsername(), "修改菜单:"+menu.getMENU_NAME());				//记录日志
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 删除菜单
+	 * @param MENU_ID
+	 * @param out
+	 */
+	@RequestMapping(value="/delete")
+	@ResponseBody
+	public Object delete(@RequestParam String MENU_ID)throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		if(corpMenuService.listSubMenuByParentId(MENU_ID).size() > 0){//判断是否有子菜单,是:不允许删除
+			errInfo = "error";
+		}else{
+			corpMenuService.deleteMenuById(MENU_ID);
+			errInfo = "success";
+			FHLOG.save(Jurisdiction.getUsername(), "删除的菜单ID为:"+MENU_ID);				//记录日志
+		}
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 保存菜单图标
+	 * @param
+	 * @return
+	 */
+	@RequestMapping(value="/editicon")
+	@ResponseBody
+	public Object editicon()throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		corpMenuService.editicon(pd);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 显示菜单列表ztree(拓展左侧四级菜单)
+	 * @return
+	 */
+	@RequestMapping(value="/otherlistMenu")
+	@ResponseBody
+	public Object otherlistMenu(String MENU_ID)throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd.put("MENU_ID", MENU_ID);
+		String MENU_URL = corpMenuService.getMenuById(pd).getString("MENU_URL");
+		if("#".equals(MENU_URL.trim()) || "".equals(MENU_URL.trim()) || null == MENU_URL){
+			MENU_URL = "../index/default.html";
+		}
+		String roleRights = Jurisdiction.getSession().getAttribute(Jurisdiction.getUsername() + Const.SESSION_ROLE_RIGHTS).toString();	//获取本角色菜单权限
+		List<Menu> athmenuList = corpMenuService.listAllMenuQx(MENU_ID);					//获取某菜单下所有子菜单
+		athmenuList = this.readMenu(athmenuList, roleRights);							//根据权限分配菜单
+		JSONArray arr = JSONArray.fromObject(athmenuList);
+		String json = arr.toString();
+		json = json.replaceAll("MENU_ID", "id").replaceAll("PARENT_ID", "pId").replaceAll("MENU_NAME", "name").replaceAll("subMenu", "nodes").replaceAll("hasMenu", "checked").replaceAll("MENU_URL", "url").replaceAll("#", "");
+		map.put("zTreeNodes", json);
+		map.put("MENU_URL",MENU_URL);		//本ID菜单链接
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**根据角色权限获取本权限的菜单列表(递归处理)
+	 * @param menuList:传入的总菜单
+	 * @param roleRights:加密的权限字符串
+	 * @return
+	 */
+	public List<Menu> readMenu(List<Menu> menuList,String roleRights){
+		for(int i=0;i<menuList.size();i++){
+			menuList.get(i).setHasMenu(RightsHelper.testRights(roleRights, menuList.get(i).getMENU_ID()));
+			if(menuList.get(i).isHasMenu() && "1".equals(menuList.get(i).getMENU_STATE())){	//判断是否有此菜单权限并且是否隐藏
+				this.readMenu(menuList.get(i).getSubMenu(), roleRights);					//是:继续排查其子菜单
+			}else{
+				menuList.remove(i);
+				i--;
+			}
+		}
+		return menuList;
+	}
+
+}
diff --git a/src/main/java/com/zcloud/controller/corpsystem/CorpRoleController.java b/src/main/java/com/zcloud/controller/corpsystem/CorpRoleController.java
new file mode 100644
index 00000000..fe8866b6
--- /dev/null
+++ b/src/main/java/com/zcloud/controller/corpsystem/CorpRoleController.java
@@ -0,0 +1,447 @@
+package com.zcloud.controller.corpsystem;
+
+import com.zcloud.controller.base.BaseController;
+import com.zcloud.entity.Page;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Menu;
+import com.zcloud.entity.system.Role;
+import com.zcloud.service.bus.CorpInfoService;
+import com.zcloud.service.system.FHlogService;
+import com.zcloud.service.system.corpsystem.CorpMenuService;
+import com.zcloud.service.system.corpsystem.CorpRoleService;
+import com.zcloud.service.system.corpsystem.CorpUsersService;
+import com.zcloud.util.DateUtil;
+import com.zcloud.util.Jurisdiction;
+import com.zcloud.util.RightsHelper;
+import com.zcloud.util.Tools;
+import net.sf.json.JSONArray;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.math.BigInteger;
+import java.util.*;
+
+/**
+ * 说明:角色处理类
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+@Controller
+@RequestMapping("/corpRrole")
+public class CorpRoleController extends BaseController {
+
+	@Autowired
+    private CorpRoleService corpRoleService;
+	@Autowired
+    private CorpUsersService corpUsersService;
+	@Autowired
+    private CorpMenuService corpMenuService;
+	@Autowired
+	private CorpInfoService corpInfoService;
+	@Autowired
+    private FHlogService FHLOG;
+
+	/** 进入权限首页
+	 * @param
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/list")
+	@ResponseBody
+	public Object list()throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = this.getPageData();
+		// 横排一级组
+		String corpId = Jurisdiction.getCORPINFO_ID();
+		pd.put("CORPINFO_ID", corpId);
+		PageData corp = corpInfoService.findById(pd);
+		PageData fpd = new PageData();
+		fpd.put("CORPINFO_ID",corp.getString("ROLE_NAME"));
+		fpd.put("ROLE_ID",corp.getString("ROLE_NAME"));
+		pd.put("ROLE_ID",corp.getString("ROLE_NAME"));
+		Role roleList = corpRoleService.getRoleById(corp.getString("ROLE_NAME"));		//列出组(页面横向排列的一级组)
+		List<Role> roleList_z = corpRoleService.listAllRolesByPId(fpd);		//列出此组下架角色
+		pd = corpRoleService.findById(pd);									//取得点击的角色组(横排的)
+		map.put("pd", pd);
+		map.put("roleList", Collections.singletonList(roleList));
+		map.put("roleList_z", roleList_z);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**保存新增角色
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/add")
+	@ResponseBody
+	public Object add()throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		String parent_id = pd.getString("PARENT_ID");		//父类角色id
+		pd.put("ROLE_ID", parent_id);
+		if("0".equals(parent_id)){
+			pd.put("RIGHTS", "");							//菜单权限
+		}else{
+			String rights = corpRoleService.findById(pd).getString("RIGHTS");
+			pd.put("RIGHTS", (null == rights)?"":rights);	//组菜单权限
+		}
+		String RNUMBER = "R"+DateUtil.getDays()+Tools.getRandomNum();
+		pd.put("RNUMBER", RNUMBER);	//编码
+		pd.put("ROLE_ID", this.get32UUID());				//主键
+		pd.put("ADD_QX", "0");		//初始新增权限为否
+		pd.put("DEL_QX", "0");		//删除权限
+		pd.put("EDIT_QX", "0");		//修改权限
+		pd.put("CHA_QX", "0");		//查看权限
+		if ("".equals(pd.getString("LEVEL"))) {
+			pd.put("LEVEL",0);
+		}
+		corpRoleService.add(pd);
+		FHLOG.save(Jurisdiction.getUsername(), "新增角色"+pd.getString("ROLE_NAME"));				//记录日志
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**请求编辑
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/toEdit")
+	@ResponseBody
+	public Object toEdit()throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		pd = corpRoleService.findById(pd);
+		map.put("pd", pd);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**保存修改
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/edit")
+	@ResponseBody
+	public Object edit()throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		corpRoleService.edit(pd);
+		FHLOG.save(Jurisdiction.getUsername(), "修改角色"+pd.getString("ROLE_NAME"));				//记录日志
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**删除角色
+	 * @param ROLE_ID
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/delete")
+	@ResponseBody
+	public Object deleteRole(@RequestParam String ROLE_ID)throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		PageData pd = new PageData();
+		String errInfo = "success";
+		pd.put("ROLE_ID", ROLE_ID);
+		List<Role> roleList_z = corpRoleService.listAllRolesByPId(pd);			//列出此角色的所有下级
+		if("fhadminzhuche".equals(ROLE_ID)|| roleList_z.size() > 0){
+//			errInfo = "false";												//下级有数据时or注册用户角色,删除失败
+			errInfo = "fail";
+			map.put("result", "errInfo");
+			map.put("msg", "此组下有角色,不能删除!");
+			return map;
+		}else{
+			List<PageData> userlist = corpUsersService.listAllUserByRoldId(pd);	//此角色下的用户
+			if(userlist.size() > 0){										//此角色已被使用就不能删除
+				errInfo = "false2";
+			}else{
+			corpRoleService.deleteRoleById(ROLE_ID);							//执行删除
+			errInfo = "success";
+			FHLOG.save(Jurisdiction.getUsername(), "删除角色ID为:"+ROLE_ID);	//记录日志
+			}
+		}
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 显示菜单列表ztree(菜单授权菜单)
+	 * @return
+	 */
+	@RequestMapping(value="/menuqx")
+	@ResponseBody
+	public Object listAllMenu(String ROLE_ID)throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		Role role = corpRoleService.getRoleById(ROLE_ID);			//根据角色ID获取角色对象
+		String roleRights = role.getRIGHTS();					//取出本角色菜单权限
+		List<Menu> menuList = corpMenuService.listAllMenuQx("0");	//获取所有菜单
+		menuList = this.readMenu(menuList, roleRights);			//根据角色权限处理菜单权限状态(递归处理)
+		JSONArray arr = JSONArray.fromObject(menuList);
+		String json = arr.toString();
+		json = json.replaceAll("MENU_ID", "id").replaceAll("PARENT_ID", "pId").replaceAll("MENU_NAME", "name").replaceAll("subMenu", "nodes").replaceAll("hasMenu", "checked");
+		map.put("zTreeNodes", json);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**根据角色权限处理权限状态(递归处理)
+	 * @param menuList:传入的总菜单
+	 * @param roleRights:加密的权限字符串
+	 * @return
+	 */
+	public List<Menu> readMenu(List<Menu> menuList,String roleRights){
+		for(int i=0;i<menuList.size();i++){
+			menuList.get(i).setHasMenu(RightsHelper.testRights(roleRights, menuList.get(i).getMENU_ID()));
+			this.readMenu(menuList.get(i).getSubMenu(), roleRights);					//是:继续排查其子菜单
+		}
+		return menuList;
+	}
+
+	/**保存角色菜单权限
+	 * @param ROLE_ID 角色ID
+	 * @param menuIds 菜单ID集合
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/saveMenuqx")
+	@ResponseBody
+	public Object saveMenuqx(@RequestParam String ROLE_ID,@RequestParam String menuIds)throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		PageData pd = new PageData();
+		if(null != menuIds && !"".equals(menuIds.trim())){
+			BigInteger rights = RightsHelper.sumRights(Tools.str2StrArray(menuIds));//用菜单ID做权处理
+			Role role = corpRoleService.getRoleById(ROLE_ID);	//通过id获取角色对象
+			role.setRIGHTS(rights.toString());
+			corpRoleService.updateRoleRights(role);				//更新当前角色菜单权限
+			pd.put("rights",rights.toString());
+		}else{
+			Role role = new Role();
+			role.setRIGHTS("");
+			role.setROLE_ID(ROLE_ID);
+			corpRoleService.updateRoleRights(role);				//更新当前角色菜单权限(没有任何勾选)
+			pd.put("rights","");
+		}
+		pd.put("ROLE_ID", ROLE_ID);
+		if(!"1".equals(ROLE_ID)){							//当修改admin权限时,不修改其它角色权限
+			corpRoleService.setAllRights(pd);					//更新此角色所有子角色的菜单权限
+		}
+		map.put("result", "success");
+		FHLOG.save(Jurisdiction.getUsername(), "给角色ID:"+ROLE_ID+" 授权了菜单权限操作");	//记录日志
+		return map;
+	}
+
+	/**请求角色按钮授权页面(增删改查)
+	 * @param ROLE_ID: 角色ID
+	 * @param msg: 区分增删改查
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/b4Button")
+	@ResponseBody
+	public Object b4Button(@RequestParam String ROLE_ID,@RequestParam String msg)throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		List<Menu> menuList = corpMenuService.listAllMenuQx("0"); //获取所有菜单
+		Role role = corpRoleService.getRoleById(ROLE_ID);		  //根据角色ID获取角色对象
+		String roleRights = "";
+		if("add_qx".equals(msg)){
+			roleRights = role.getADD_QX();	//新增权限
+		}else if("del_qx".equals(msg)){
+			roleRights = role.getDEL_QX();	//删除权限
+		}else if("edit_qx".equals(msg)){
+			roleRights = role.getEDIT_QX();	//修改权限
+		}else if("cha_qx".equals(msg)){
+			roleRights = role.getCHA_QX();	//查看权限
+		}
+		menuList = this.readMenu(menuList, roleRights);		//根据角色权限处理菜单权限状态(递归处理)
+		JSONArray arr = JSONArray.fromObject(menuList);
+		String json = arr.toString();
+		json = json.replaceAll("MENU_ID", "id").replaceAll("PARENT_ID", "pId").replaceAll("MENU_NAME", "name").replaceAll("subMenu", "nodes").replaceAll("hasMenu", "checked");
+		map.put("zTreeNodes", json);
+		map.put("result", "success");
+		return map;
+	}
+
+	/**
+	 * 保存角色按钮权限
+	 * @param ROLE_ID
+	 * @param menuIds
+	 * @param msg
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/saveB4Button")
+	@ResponseBody
+	public Object saveB4Button(@RequestParam String ROLE_ID,@RequestParam String menuIds,@RequestParam String msg)throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		if(null != menuIds && !"".equals(menuIds.trim())){
+			BigInteger rights = RightsHelper.sumRights(Tools.str2StrArray(menuIds));
+			pd.put("value",rights.toString());
+		}else{
+			pd.put("value","");
+		}
+		pd.put("ROLE_ID", ROLE_ID);
+		corpRoleService.saveB4Button(msg,pd);
+		map.put("result", "success");
+		FHLOG.save(Jurisdiction.getUsername(), "给角色ID:"+ROLE_ID+" 授权了增删改查按钮权限操作");	//记录日志
+		return map;
+	}
+
+	/** 选择角色(弹窗选择用)
+	 * @param
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/roleListWindow")
+	@ResponseBody
+	public Object roleListWindow(Page page)throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		String KEYWORDS = pd.getString("KEYWORDS");						//关键词检索条件
+		if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
+		page.setPd(pd);
+		List<PageData> roleList = corpRoleService.roleListWindow(page);		//列出所有角色
+		map.put("roleList", roleList);
+		map.put("page", page);
+		map.put("result", "success");
+		return map;
+	}
+
+	/**根据名称查询角色
+	 * @param ROLE_ID
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/findByName")
+	@ResponseBody
+	public Object findByName()throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+//		pd = corpRoleService.findByName(pd);///
+		map.put("pd", pd);
+		map.put("result", errInfo);
+		return map;
+	}
+	@RequestMapping(value="/b4ButtonV2")
+	@ResponseBody
+	public Object b4ButtonV2(@RequestParam String ROLE_ID,@RequestParam String msg)throws Exception{
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		String pid =pd.getString("PARENT_ID");
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		Role role = corpRoleService.getRoleById(ROLE_ID);			//根据角色ID获取角色对象
+		String roleRights = "";
+		if("add_qx".equals(msg)){
+			roleRights = role.getADD_QX();	//新增权限
+		}else if("del_qx".equals(msg)){
+			roleRights = role.getDEL_QX();	//删除权限
+		}else if("edit_qx".equals(msg)){
+			roleRights = role.getEDIT_QX();	//修改权限
+		}else if("cha_qx".equals(msg)){
+			roleRights = role.getCHA_QX();	//查看权限
+		}
+		List<Menu> menuListAll = corpMenuService.listSubMenuAll();
+		Map<String,List<Menu>> menuAllMap = new HashMap<>();
+		for (int i=0;i<menuListAll.size();i++){
+			List<Menu> menuListValue = new ArrayList<>();
+			Menu menu = menuListAll.get(i);
+			if(menuAllMap.containsKey(menu.getPARENT_ID())){
+				menuListValue = menuAllMap.get(menu.getPARENT_ID());
+			}
+			menuListValue.add(menu);
+			menuAllMap.put(menu.getPARENT_ID(),menuListValue);
+		}
+		List<Menu> menuList = this.listAllMenuDigui("0",menuAllMap,roleRights);	//获取所有菜单
+		menuList = this.readMenu(menuList, roleRights);			//根据角色权限处理菜单权限状态(递归处理)
+		JSONArray arr = JSONArray.fromObject(menuList);
+		String json = arr.toString();
+		json = json.replaceAll("MENU_ID", "id")
+				.replaceAll("PARENT_ID", "pId")
+				.replaceAll("MENU_NAME", "name")
+				.replaceAll("subMenu", "nodes")
+				.replaceAll("hasMenu", "checked");
+		map.put("zTreeNodes", json);
+		map.put("result", errInfo);
+		return map;
+
+	}
+	/**
+	 * 显示菜单列表ztree(菜单授权菜单)
+	 * @return
+	 */
+	@RequestMapping(value="/listAllMenuV2")
+	@ResponseBody
+	public Object listAllMenuByParentID(String ROLE_ID)throws Exception{
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		String pid =pd.getString("PARENT_ID");
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		Role role = corpRoleService.getRoleById(ROLE_ID);			//根据角色ID获取角色对象
+		String roleRights = role.getRIGHTS();					//取出本角色菜单权限
+		List<Menu> menuListAll = corpMenuService.listSubMenuAll();
+		Map<String,List<Menu>> menuAllMap = new HashMap<>();
+		for (int i=0;i<menuListAll.size();i++){
+			List<Menu> menuListValue = new ArrayList<>();
+			Menu menu = menuListAll.get(i);
+			if(menuAllMap.containsKey(menu.getPARENT_ID())){
+				menuListValue = menuAllMap.get(menu.getPARENT_ID());
+			}
+			menuListValue.add(menu);
+			menuAllMap.put(menu.getPARENT_ID(),menuListValue);
+		}
+		List<Menu> menuList = this.listAllMenuDigui("0",menuAllMap,roleRights);	//获取所有菜单
+		menuList = this.readMenu(menuList, roleRights);			//根据角色权限处理菜单权限状态(递归处理)
+		JSONArray arr = JSONArray.fromObject(menuList);
+		String json = arr.toString();
+		json = json.replaceAll("MENU_ID", "id")
+				.replaceAll("PARENT_ID", "pId")
+				.replaceAll("MENU_NAME", "name")
+				.replaceAll("subMenu", "nodes")
+				.replaceAll("hasMenu", "checked");
+		map.put("zTreeNodes", json);
+		map.put("result", errInfo);
+		return map;
+
+	}
+
+	/**
+	 *
+	 * @param MENU_ID
+	 * @param menuAllList key pid  val Pid 下面的list
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Menu> listAllMenuDigui(String MENU_ID,Map<String,List<Menu>> menuAllList,String roleRights) throws Exception {
+		List<Menu> menuList = this.listSubMenuByParentId(MENU_ID,menuAllList);  //更具pid 获取数据
+		for(Menu menu : menuList){
+			menu.setMENU_URL("menu_edit.html?MENU_ID="+menu.getMENU_ID());
+			menu.setSubMenu(this.listAllMenuDigui(menu.getMENU_ID(),menuAllList,roleRights));
+			menu.setTarget("treeFrame");
+			menu.setHasMenu(RightsHelper.testRights(roleRights, menu.getMENU_ID()));
+		}
+		return menuList;
+	}
+	public List<Menu> listSubMenuByParentId (String MENU_ID,Map<String,List<Menu>> menuAllList){ //更具pid 获取数据
+		List<Menu>  menuList = new ArrayList<>();
+		if(menuAllList.containsKey(MENU_ID)){
+			menuList = menuAllList.get(MENU_ID);
+		}
+		return menuList;
+	}
+}
diff --git a/src/main/java/com/zcloud/controller/corpsystem/CorpUsersController.java b/src/main/java/com/zcloud/controller/corpsystem/CorpUsersController.java
new file mode 100644
index 00000000..4653f46c
--- /dev/null
+++ b/src/main/java/com/zcloud/controller/corpsystem/CorpUsersController.java
@@ -0,0 +1,725 @@
+package com.zcloud.controller.corpsystem;
+
+import com.zcloud.controller.base.BaseController;
+import com.zcloud.entity.Page;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Department;
+import com.zcloud.entity.system.Role;
+import com.zcloud.service.system.DepartmentService;
+import com.zcloud.service.system.FHlogService;
+import com.zcloud.service.system.RoleService;
+import com.zcloud.service.system.UeditorService;
+import com.zcloud.service.system.corpsystem.CorpUsersService;
+import com.zcloud.util.*;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.*;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.apache.shiro.crypto.hash.SimpleHash;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 说明:系统用户处理类
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+@Controller
+@RequestMapping("/corpUser")
+public class CorpUsersController extends BaseController {
+
+	@Autowired
+    private CorpUsersService corpUsersService;
+	@Autowired
+    private RoleService roleService;
+	@Autowired
+	private UeditorService ueditorService;
+	@Autowired
+    private FHlogService FHLOG;
+	@Autowired
+	private DepartmentService departmentService;
+
+
+	/**列表
+	 * @param page
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/listAll")
+	@ResponseBody
+	public Object listAll() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		List<PageData>	userList = corpUsersService.listAllUser(pd);	//列出Post列表
+		map.put("userList", userList);
+		map.put("result", errInfo);
+		return map;
+	}
+
+
+
+
+
+
+
+
+	/**用户列表
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/list")
+	@ResponseBody
+	public Object listUsers(Page page)throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+
+		/*检索条件*/
+		String ROLE_ID = pd.getString("ROLE_ID");						//角色ID
+		String KEYWORDS = pd.getString("KEYWORDS");						//关键词检索条件
+		if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
+		String STRARTTIME = pd.getString("STRARTTIME");					//开始时间
+		String ENDTIME = pd.getString("ENDTIME");						//结束时间
+		if(Tools.notEmpty(STRARTTIME))pd.put("STRARTTIME", STRARTTIME+" 00:00:00");
+		if(Tools.notEmpty(ENDTIME))pd.put("ENDTIME", ENDTIME+" 00:00:00");
+		if(!"admin".equals(Jurisdiction.getUsername())) {
+			Session session = Jurisdiction.getSession();
+			PageData dept = (PageData)session.getAttribute(Const.SESSION_DEPT);
+			if(Tools.isEmpty(pd.get("PROVINCE")) && Tools.isEmpty(pd.get("CITY")) && Tools.isEmpty(pd.get("COUNTRY")) && Tools.isEmpty(pd.get("VILLAGE")) ){
+				if (!"000000".equals(dept.getString("PROVINCE"))){
+					pd.put("PROVINCE", dept.get("PROVINCE"));
+				}
+				pd.put("CITY", dept.get("CITY"));
+				pd.put("COUNTRY", dept.get("COUNTRY"));
+				pd.put("VILLAGE", dept.get("VILLAGE"));
+			}
+		}
+		page.setPd(pd);
+		List<PageData>	userList = corpUsersService.userlistPage(page);		//列出用户列表
+		pd.put("ROLE_ID", "1");
+		List<Role> roleList = roleService.listAllRolesByPId(pd);		//列出所有系统用户角色
+
+		map.put("userList", userList);
+		map.put("roleList", roleList);
+		map.put("ROLE_ID", ROLE_ID);
+		map.put("page", page);
+		map.put("pd", pd);
+
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**去新增用户页面
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/goAddUser")
+	@ResponseBody
+	public Object goAddUser()throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd.put("ROLE_ID", "1");
+		List<Role> roleList = roleService.listAllRolesByPId(pd);		//列出所有系统用户角色
+		map.put("roleList", roleList);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**去修改用户页面(从系统用户页面修改)
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/goEditUser")
+	@ResponseBody
+	public Object goEditUser() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		if("1".equals(pd.getString("USER_ID"))){return null;}		//不能修改admin用户
+		pd.put("ROLE_ID", "1");
+		List<Role> roleList = roleService.listAllRolesByPId(pd);	//列出所有系统用户角色
+		List<Department> departmentList=departmentService.listAllDepartment("c14c41b8058b421ba6b988c2c3bd3139");
+		pd = corpUsersService.findById(pd);								//根据ID读取
+		String ROLE_IDS = pd.getString("ROLE_IDS");					//副职角色ID
+		if(Tools.notEmpty(ROLE_IDS)){
+			String arryROLE_ID[] = ROLE_IDS.split(",");
+			for(int i=0;i<roleList.size();i++){
+				Role role = roleList.get(i);
+				String roleId = role.getROLE_ID();
+				for(int n=0;n<arryROLE_ID.length;n++){
+					if(arryROLE_ID[n].equals(roleId)){
+						role.setRIGHTS("1");	//此时的目的是为了修改用户信息上,能看到副职角色都有哪些
+						break;
+					}
+				}
+			}
+		}
+		map.put("pd", pd);
+		map.put("roleList", roleList);
+		map.put("departmentList", departmentList);
+		PageData pd2 = new PageData();
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**去修改用户页面(个人资料修改)
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/goEditMyInfo")
+	@ResponseBody
+	public Object goEditMyInfo() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		pd.put("ROLE_ID", "1");
+		List<Role> roleList = roleService.listAllRolesByPId(pd);	//列出所有系统用户角色
+		pd.put("USERNAME", Jurisdiction.getUsername());
+		pd = corpUsersService.findByUsername(pd);						//根据用户名读取
+		map.put("pd", pd);
+		map.put("roleList", roleList);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 修改用户(系统用户列表修改)
+	 */
+	@RequestMapping(value="/editUser")
+	@ResponseBody
+	public Object editUser() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		FHLOG.save(Jurisdiction.getUsername(), "从系统用户中修改"+pd.getString("USERNAME")+"的资料");				//记录日志
+		if(!Jurisdiction.getUsername().equals(pd.getString("USERNAME"))){ //如果当前登录用户修改用户资料提交的用户名非本人
+			if("admin".equals(pd.getString("USERNAME")) && !"admin".equals(Jurisdiction.getUsername())){return null;}	//非admin用户不能修改admin
+		}else{	//如果当前登录用户修改用户资料提交的用户名是本人,则不能修改本人的角色ID
+			PageData upd = new PageData();
+			upd = corpUsersService.findByUsername(pd);
+			pd.put("ROLE_ID", upd.getString("ROLE_ID")); //对角色ID还原本人角色ID
+			pd.put("ROLE_IDS", Tools.notEmpty(upd.getString("ROLE_IDS"))?upd.get("ROLE_IDS"):""); //对角色ID还原本人副职角色ID
+		}
+		if(pd.getString("PASSWORD") != null && !"".equals(pd.getString("PASSWORD"))){
+			pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), pd.getString("PASSWORD")).toString());
+		}
+		corpUsersService.editUser(pd);	//执行修改
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 修改用户(系统用户列表修改)
+	 */
+	@RequestMapping(value="/editUserFuns")
+	@ResponseBody
+	public Object editUserFuns() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		FHLOG.save(Jurisdiction.getUsername(), "从系统用户中修改"+pd.getString("USERNAME")+"的小程序菜单权限");				//记录日志
+		corpUsersService.editUserFuns(pd);	//执行修改
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 修改用户(个人资料修改)
+	 */
+	@RequestMapping(value="/editUserOwn")
+	@ResponseBody
+	public Object editUserOwn() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		if(!Jurisdiction.getUsername().equals(pd.getString("USERNAME"))){ //如果当前登录用户修改用户资料提交的用户名非本人
+			FHLOG.save(Jurisdiction.getUsername(), "恶意修改用户资料:"+pd.getString("USERNAME"));
+			return null;//不能修改非本人的资料
+		}else{			//如果当前登录用户修改用户资料提交的用户名是本人,则不能修改本人的角色ID
+			PageData upd = new PageData();
+			upd = corpUsersService.findByUsername(pd);
+			pd.put("USER_ID", upd.getString("USER_ID")); //对ID还原本人ID,防止串改
+			pd.put("ROLE_ID", upd.getString("ROLE_ID")); //对角色ID还原本人角色ID
+			pd.put("ROLE_IDS", Tools.notEmpty(upd.getString("ROLE_IDS"))?upd.get("ROLE_IDS"):""); //对角色ID还原本人副职角色ID
+		}
+		if(pd.getString("PASSWORD") != null && !"".equals(pd.getString("PASSWORD"))){
+			pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), pd.getString("PASSWORD")).toString());
+		}
+		corpUsersService.editUser(pd);	//执行修改
+		FHLOG.save(Jurisdiction.getUsername(), "从个人资料中修改"+pd.getString("USERNAME")+"的资料");				//记录日志
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * 修改用户密码()
+	 */
+	@RequestMapping(value="/editUserPwd")
+	@ResponseBody
+	public Object editUserPwd() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		String userName = Jurisdiction.getUsername();
+		String userOldPwd = pd.getString("password");
+		UsernamePasswordToken token = new UsernamePasswordToken(userName, new SimpleHash("SHA-1", userName, userOldPwd).toString());
+
+		Subject subject = SecurityUtils.getSubject();
+		try {
+			subject.login(token);								//这一步在调用login(token)方法时,它会走到MyRealm.doGetAuthenticationInfo()方法中
+        }catch(UnknownAccountException uae){
+            errInfo = "usererror";
+        }catch(IncorrectCredentialsException ice){
+        	errInfo = "usererror";
+        }catch(LockedAccountException lae){
+        	errInfo = "usererror";
+        }catch(ExcessiveAttemptsException eae){
+        	errInfo = "usererror4";
+        }catch (DisabledAccountException sae){
+        	errInfo = "usererror";
+        }catch(AuthenticationException ae){
+        	errInfo = "usererror";
+        }
+
+		if("success".equals(errInfo)) {
+			if(subject.isAuthenticated()){	//密码验证成功
+				String newPwd =new SimpleHash("SHA-1",userName, pd.getString("newpwd")).toString();//加密新密码
+				PageData updateUserPd = new PageData();
+				updateUserPd.put("USER_ID", Jurisdiction.getUSER_ID());
+				updateUserPd.put("PASSWORD", newPwd);
+				corpUsersService.editPassword(updateUserPd);
+				FHLOG.save(userName, "从app修改密码中修改"+userName+"的密码");				//记录日志
+			}else {
+				token.clear();
+	            errInfo = "usererror";
+			}
+		}else {
+			errInfo="error";
+			map.put("result", errInfo);
+			map.put("msg", "用户密码错误");
+			return map;
+		}
+		/**
+		 * 1.验证原始密码是否正确
+		 * 2.密码加密
+		 * 3.修改数据库
+		 * 4.增加日志
+		 */
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**
+	 * @param page
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/resetPwd")
+	@ResponseBody
+	public Object resetPwd (Page page) throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		PageData pageData = corpUsersService.findById(pd);
+		//corpInfo
+		String pwd = new SimpleHash("SHA-1", pageData.getString("USERNAME"), "Aa@123456789").toString();
+		PageData updateUser = new PageData();
+		updateUser.put("PASSWORD", pwd);
+		updateUser.put("USER_ID", pageData.getString("USER_ID"));
+		corpUsersService.editPassword(updateUser);
+
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**判断用户名是否存在
+	 * @return
+	 */
+	@RequestMapping(value="/hasUser")
+	@ResponseBody
+	public Object hasUser() throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		if(corpUsersService.findByUsername(pd) != null){
+			errInfo = "fail";
+		}
+		map.put("result", errInfo);				//返回结果
+		return map;
+	}
+
+	/**判断邮箱是否存在
+	 * @return
+	 */
+	@RequestMapping(value="/hasEmail")
+	@ResponseBody
+	public Object hasEmail() throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		if(corpUsersService.findByEmail(pd) != null){
+			errInfo = "error";
+		}
+		map.put("result", errInfo);				//返回结果
+		return map;
+	}
+
+	/**判断编码是否存在
+	 * @return
+	 */
+	@RequestMapping(value="/hasNumber")
+	@ResponseBody
+	public Object hasNumber() throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		if(corpUsersService.findByNumbe(pd) != null){
+			errInfo = "error";
+		}
+		map.put("result", errInfo);				//返回结果
+		return map;
+	}
+
+	/**保存用户
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/saveUser")
+	@ResponseBody
+	public Object saveUser() throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		pd.put("USER_ID", this.get32UUID());			//ID 主键
+		pd.put("LAST_LOGIN", "");						//最后登录时间
+		pd.put("IP", "");								//IP
+		pd.put("STATUS", "0");							//状态
+		pd.put("SKIN", "pcoded-navbar navbar-image-3,navbar pcoded-header navbar-expand-lg navbar-light header-dark,");		//用户默认皮肤
+		String userPwd = Tools.isEmpty(pd.get("PASSWORD"))?"Aa@123456789" : pd.getString("PASSWORD");
+		pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), userPwd).toString());			//密码加密
+		String[] userRole = pd.getString("roleIDs").split(";"); //处理多角色的用户
+		pd.put("ROLE_ID",userRole[0]);
+		pd.put("PASSWORD",pd.getString("userPASSWORD"));
+		if(userRole.length>1){
+			String ROLE_IDS =pd.getString("roleIDs").replaceAll(";",",").replaceAll(userRole[0]+',' ,"");
+			pd.put("ROLE_IDS",ROLE_IDS);
+		}
+		if(null == corpUsersService.findByUsername(pd)){	//判断用户名是否存在
+			corpUsersService.saveUser(pd); 					//执行保存
+		}else{
+			map.put("result","failed");
+		}
+		FHLOG.save(Jurisdiction.getUsername(), "新增用户:"+pd.getString("USERNAME"));				//记录日志
+		map.put("result", errInfo);				//返回结果
+		return map;
+	}
+
+	/**删除用户
+	 * @return
+	 */
+	@RequestMapping(value="/deleteUser")
+	@ResponseBody
+	public Object deleteUser() throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		PageData pd = new PageData();
+		String errInfo = "success";
+		pd = this.getPageData();
+		FHLOG.save(Jurisdiction.getUsername(), "删除用户ID:"+pd.getString("USER_ID"));				//记录日志
+		corpUsersService.deleteUser(pd);			//删除用户
+		ueditorService.delete(pd);				//删除副文本关联数据
+		map.put("result", errInfo);				//返回结果
+		return map;
+	}
+
+	/**
+	 * 批量删除
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/deleteAllUser")
+	@ResponseBody
+	public Object deleteAllUser() throws Exception{
+		PageData pd = new PageData();
+		Map<String,Object> map = new HashMap<String,Object>();
+		pd = this.getPageData();
+		String USER_IDS = pd.getString("USER_IDS");
+		String errInfo = "success";
+		if(Tools.notEmpty(USER_IDS)){
+			String ArrayUSER_IDS[] = USER_IDS.split(",");
+			FHLOG.save(Jurisdiction.getUsername(), "批量删除用户");				//记录日志
+			corpUsersService.deleteAllUser(ArrayUSER_IDS);	//删除用户
+			ueditorService.deleteAll(ArrayUSER_IDS);	//删除副文本关联数据
+			errInfo = "success";
+		}else{
+			errInfo = "error";
+		}
+		map.put("result", errInfo);				//返回结果
+		return map;
+	}
+
+	/**导出用户信息到EXCEL
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/excel")
+	public ModelAndView exportExcel() throws Exception{
+		ModelAndView mv = new ModelAndView();
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		try{
+
+			/*检索条件*/
+			String KEYWORDS = pd.getString("KEYWORDS");						//关键词检索条件
+			if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
+			String STRARTTIME = pd.getString("STRARTTIME");					//开始时间
+			String ENDTIME = pd.getString("ENDTIME");						//结束时间
+			if(Tools.notEmpty(STRARTTIME))pd.put("STRARTTIME", STRARTTIME+" 00:00:00");
+			if(Tools.notEmpty(ENDTIME))pd.put("ENDTIME", ENDTIME+" 00:00:00");
+
+			Map<String,Object> dataMap = new HashMap<String,Object>();
+			List<String> titles = new ArrayList<String>();
+			titles.add("用户名"); 		//1
+			titles.add("编号");  		//2
+			titles.add("姓名");			//3
+			titles.add("职位");			//4
+			titles.add("手机");			//5
+			titles.add("邮箱");			//6
+			titles.add("最近登录");		//7
+			titles.add("上次登录IP");	//8
+			dataMap.put("titles", titles);
+			List<PageData> userList = corpUsersService.listAllUser(pd);
+			List<PageData> varList = new ArrayList<PageData>();
+			for(int i=0;i<userList.size();i++){
+				PageData vpd = new PageData();
+				vpd.put("var1", userList.get(i).getString("USERNAME"));		//1
+				vpd.put("var2", userList.get(i).getString("NUMBER"));		//2
+				vpd.put("var3", userList.get(i).getString("NAME"));			//3
+				vpd.put("var4", userList.get(i).getString("ROLE_NAME"));	//4
+				vpd.put("var5", userList.get(i).getString("PHONE"));		//5
+				vpd.put("var6", userList.get(i).getString("EMAIL"));		//6
+				vpd.put("var7", userList.get(i).getString("LAST_LOGIN"));	//7
+				vpd.put("var8", userList.get(i).getString("IP"));			//8
+				varList.add(vpd);
+			}
+			dataMap.put("varList", varList);
+			ObjectExcelView erv = new ObjectExcelView();					//执行excel操作
+			mv = new ModelAndView(erv,dataMap);
+		} catch(Exception e){
+		}
+		return mv;
+	}
+
+	/**下载模版
+	 * @param response
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/downExcel")
+	public void downExcel(HttpServletResponse response)throws Exception{
+		FileDownload.fileDownload(response, PathUtil.getProjectpath() + Const.FILEPATHFILE + "Users.xls", "Users.xls");
+	}
+
+	/**从EXCEL导入到数据库
+	 * @param file
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/readExcel")
+	@SuppressWarnings("unchecked")
+	@ResponseBody
+	public Object readExcel(@RequestParam(value="excel",required=false) MultipartFile file) throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		if (null != file && !file.isEmpty()) {
+			String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
+			if (!"xls".equals(suffixName)) {
+				map.put("result", "fail");
+				map.put("exception", "上传文件格式不正确");
+				return map;
+			}
+			String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE;								//文件上传路径
+			String fileName =  FileUpload.fileUp(file, filePath, "userexcel");								//执行上传
+			List<PageData> listPd = (List)ObjectExcelRead.readExcel(filePath, fileName, 2, 0, 0);			//执行读EXCEL操作,读出的数据导入List 2:从第3行开始;0:从第A列开始;0:第0个sheet
+			pd.put("LAST_LOGIN", "");				//最后登录时间
+			pd.put("IP", "");						//IP
+			pd.put("STATUS", "0");					//状态
+			pd.put("SKIN", "pcoded-navbar navbar-image-3,navbar pcoded-header navbar-expand-lg navbar-light header-dark,");					//默认皮肤
+			pd.put("ROLE_ID", "fhadminzhuche");		//默认角色注册用户
+			pd.put("ROLE_IDS", "");					//副职角色
+			/**
+			 * var0 :编号
+			 * var1 :姓名
+			 * var2 :手机
+			 * var3 :邮箱
+			 * var4 :备注
+			 */
+			for(int i=0;i<listPd.size();i++){
+				pd.put("USER_ID", this.get32UUID());										//ID
+				pd.put("NAME", listPd.get(i).getString("var1"));							//姓名
+				String USERNAME = GetPinyin.getPingYin(listPd.get(i).getString("var1"));	//根据姓名汉字生成全拼
+				pd.put("USERNAME", USERNAME);
+				if(corpUsersService.findByUsername(pd) != null){								//判断用户名是否重复
+					USERNAME = GetPinyin.getPingYin(listPd.get(i).getString("var1"))+Tools.getRandomNum();
+					pd.put("USERNAME", USERNAME);
+				}
+				pd.put("BZ", listPd.get(i).getString("var4"));								//备注
+				if(Tools.checkEmail(listPd.get(i).getString("var3"))){						//邮箱格式不对就跳过
+					pd.put("EMAIL", listPd.get(i).getString("var3"));
+					if(corpUsersService.findByEmail(pd) != null){								//邮箱已存在就跳过
+						continue;
+					}
+				}else{
+					continue;
+				}
+				pd.put("NUMBER", listPd.get(i).getString("var0"));							//编号已存在就跳过
+				pd.put("PHONE", listPd.get(i).getString("var2"));							//手机号
+
+				pd.put("PASSWORD", new SimpleHash("SHA-1", USERNAME, Const.DEFAULT_PASSWORD).toString());	//默认密码123
+				if(corpUsersService.findByNumbe(pd) != null){
+					continue;
+				}
+				corpUsersService.saveUser(pd);
+			}
+		}
+		map.put("result", errInfo);				//返回结果
+		return map;
+	}
+
+	/**去修改用户页面(在线管理页面打开)
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/goEditUfromOnline")
+	@ResponseBody
+	public Object goEditUfromOnline() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		if("admin".equals(pd.getString("USERNAME"))){return null;}	//不能查看admin用户
+		pd.put("ROLE_ID", "1");
+		List<Role> roleList = roleService.listAllRolesByPId(pd);	//列出所有系统用户角色
+		map.put("fx", "user");
+		pd = corpUsersService.findByUsername(pd);						//根据ID读取
+		String ROLE_IDS = pd.getString("ROLE_IDS");					//副职角色ID
+		if(Tools.notEmpty(ROLE_IDS)){
+			String arryROLE_ID[] = ROLE_IDS.split(",");
+			for(int i=0;i<roleList.size();i++){
+				Role role = roleList.get(i);
+				String roleId = role.getROLE_ID();
+				for(int n=0;n<arryROLE_ID.length;n++){
+					if(arryROLE_ID[n].equals(roleId)){
+						role.setRIGHTS("1");	//此时的目的是为了修改用户信息上,能看到副职角色都有哪些
+						break;
+					}
+				}
+			}
+		}
+		map.put("pd", pd);
+		map.put("roleList", roleList);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**查看用户
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/view")
+	@ResponseBody
+	public Object view() throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		String USERNAME = pd.getString("USERNAME");
+		if("admin".equals(USERNAME)){return null;}					//不能查看admin用户
+		pd.put("ROLE_ID", "1");
+		List<Role> roleList = roleService.listAllRolesByPId(pd);	//列出所有系统用户角色
+		pd = corpUsersService.findByUsername(pd);						//根据ID读取
+		map.put("msg", "1");
+		if(null == pd){
+			PageData rpd = new PageData();
+			rpd.put("RNUMBER", USERNAME);							//用户名查不到数据时就把数据当作角色的编码去查询角色表
+			rpd = roleService.getRoleByRnumber(rpd);
+			map.put("rpd", rpd);
+			map.put("msg", "2");
+		}
+		map.put("pd", pd);
+		map.put("roleList", roleList);
+		map.put("result", errInfo);
+		return map;
+	}
+
+	/**显示用户列表(弹窗选择用)
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="/listUsersForWindow")
+	@ResponseBody
+	public Object listUsersForWindow(Page page)throws Exception{
+		Map<String,Object> map = new HashMap<String,Object>();
+		String errInfo = "success";
+		PageData pd = new PageData();
+		pd = this.getPageData();
+		String KEYWORDS = pd.getString("KEYWORDS");						//关键词检索条件
+		if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
+		String STRARTTIME = pd.getString("STRARTTIME");					//开始时间
+		String ENDTIME = pd.getString("ENDTIME");						//结束时间
+		if(Tools.notEmpty(STRARTTIME))pd.put("STRARTTIME", STRARTTIME+" 00:00:00");
+		if(Tools.notEmpty(ENDTIME))pd.put("ENDTIME", ENDTIME+" 00:00:00");
+		page.setPd(pd);
+		List<PageData>	userList = corpUsersService.listUsersBystaff(page);	//列出用户列表(弹窗选择用)
+		pd.put("ROLE_ID", "1");
+		List<Role> roleList = roleService.listAllRolesByPId(pd);		//列出所有系统用户角色
+		map.put("userList", userList);
+		map.put("roleList", roleList);
+		map.put("page", page);
+		map.put("pd", pd);
+		map.put("result", errInfo);
+		return map;
+	}
+	/**修改用户状态 STATUS
+	 * @return
+	 */
+	@RequestMapping(value="/updateUserStatus")
+	@ResponseBody
+	public Object updateUserStatus() throws Exception{
+		Map<String,String> map = new HashMap<String,String>();
+		PageData pd = new PageData();
+		String errInfo = "success";
+		pd = this.getPageData();
+		pd.put("STATUS",pd.getString("status"));
+		corpUsersService.updateUserStatus(pd);
+		FHLOG.save(Jurisdiction.getUsername(), "修改用户状态ID:"+pd.getString("USER_ID"));				//记录日志
+		map.put("result", errInfo);				//返回结果
+		return map;
+	}
+
+}
diff --git a/src/main/java/com/zcloud/controller/system/ButtonrightsController.java b/src/main/java/com/zcloud/controller/system/ButtonrightsController.java
index 2be7d301..d02e5a6d 100644
--- a/src/main/java/com/zcloud/controller/system/ButtonrightsController.java
+++ b/src/main/java/com/zcloud/controller/system/ButtonrightsController.java
@@ -1,9 +1,11 @@
 package com.zcloud.controller.system;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.zcloud.service.bus.CorpInfoService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -28,53 +30,62 @@ import com.zcloud.util.Tools;
 @Controller
 @RequestMapping(value="/buttonrights")
 public class ButtonrightsController extends BaseController {
-	
+
 	@Autowired
 	private ButtonrightsService buttonrightsService;
 	@Autowired
     private RoleService roleService;
+	@Autowired
+	private CorpInfoService corpInfoService;
 	@Autowired
 	private FhButtonService fhButtonService;
 	@Autowired
     private FHlogService FHLOG;
-	
+
 	/**列表
 	 * @throws Exception
 	 */
 	@RequestMapping(value="/list")
-	@RequiresPermissions("buttonrights:list")
 	@ResponseBody
 	public Object list() throws Exception{
 		Map<String,Object> map = new HashMap<String,Object>();
 		String errInfo = "success";
-		PageData pd = new PageData();
-		pd = this.getPageData();
-		if(Tools.isEmpty(pd.getString("ROLE_ID"))){
-			pd.put("ROLE_ID", "1");											//默认列出第一组角色(初始设计系统用户组不能删除)
-		}
+		PageData pd = this.getPageData();
+//		if(Tools.isEmpty(pd.getString("ROLE_ID"))){
+//			pd.put("ROLE_ID", "1");											//默认列出第一组角色(初始设计系统用户组不能删除)
+//		}
+//		PageData fpd = new PageData();
+//		fpd.put("ROLE_ID", "0");
+
+
+
+		String corpId = Jurisdiction.getCORPINFO_ID();
+		pd.put("CORPINFO_ID", corpId);
+		PageData corp = corpInfoService.findById(pd);
 		PageData fpd = new PageData();
-		fpd.put("ROLE_ID", "0");
-		List<Role> roleList = roleService.listAllRolesByPId(fpd);			//列出组(页面横向排列的一级组)
+		fpd.put("CORPINFO_ID",corp.getString("ROLE_NAME"));
+		fpd.put("ROLE_ID",corp.getString("ROLE_NAME"));
+		pd.put("ROLE_ID",corp.getString("ROLE_NAME"));
+		Role roleList = roleService.getRoleById(corp.getString("ROLE_NAME"));			//列出组(页面横向排列的一级组)
 		List<Role> roleList_z = roleService.listAllRolesByPId(pd);			//列出此组下架角色
 		List<PageData> buttonlist = fhButtonService.listAll(pd);			//列出所有按钮
 		List<PageData> roleFhbuttonlist = buttonrightsService.listAll(pd);	//列出所有角色按钮关联数据
 		pd = roleService.findById(pd);										//取得点击的角色组(横排的)
 		map.put("pd", pd);
-		map.put("roleList", roleList);
+		map.put("roleList", Collections.singletonList(roleList));
 		map.put("roleList_z", roleList_z);
 		map.put("buttonlist", buttonlist);
 		map.put("roleFhbuttonlist", roleFhbuttonlist);
 		map.put("result", errInfo);
 		return map;
 	}
-	
+
 	/**点击按钮处理关联表
 	 * @return
 	 * @throws Exception
 	 */
 	@RequestMapping(value="/upRb")
 	@ResponseBody
-	@RequiresPermissions("buttonrights:edit")
 	public Object updateRolebuttonrightd()throws Exception{
 		Map<String,String> map = new HashMap<String,String>();
 		PageData pd = new PageData();
@@ -90,5 +101,5 @@ public class ButtonrightsController extends BaseController {
 		map.put("result", errInfo);
 		return map;
 	}
-	
+
 }
diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java
index b7de469d..6c49845d 100644
--- a/src/main/java/com/zcloud/controller/system/UsersController.java
+++ b/src/main/java/com/zcloud/controller/system/UsersController.java
@@ -1703,7 +1703,6 @@ public class UsersController extends BaseController {
      *
      * @param parentId  部门父节点id
      * @param departMap 全部部门信息
-     * @param valName   部门名称
      * @return 从子节点开始往上循序
      */
     public String getParentName(String parentId, Map<String, Object> departMap) {
diff --git a/src/main/java/com/zcloud/entity/system/Role.java b/src/main/java/com/zcloud/entity/system/Role.java
index b83ae519..369c8beb 100644
--- a/src/main/java/com/zcloud/entity/system/Role.java
+++ b/src/main/java/com/zcloud/entity/system/Role.java
@@ -15,6 +15,16 @@ public class Role {
 	private String EDIT_QX;		//修改权限(存放的除权后的菜单ID)有修改权限的菜单ID
 	private String CHA_QX;		//查看权限(存放的除权后的菜单ID)有查看权限的菜单ID
 	private String RNUMBER;		//编号(在处理类中新增的时候自动生成)
+	private String DEPT_TYPE;
+
+	public String getDEPT_TYPE() {
+		return DEPT_TYPE;
+	}
+
+	public void setDEPT_TYPE(String DEPT_TYPE) {
+		this.DEPT_TYPE = DEPT_TYPE;
+	}
+
 	private String Level; //用户等级
 
 	public String getROLE_ID() {
diff --git a/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpMenuMapper.java b/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpMenuMapper.java
new file mode 100644
index 00000000..7afb951d
--- /dev/null
+++ b/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpMenuMapper.java
@@ -0,0 +1,62 @@
+package com.zcloud.mapper.datasource.corpsystem;
+
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Menu;
+
+import java.util.List;
+
+/**
+ * 说明:菜单Mapper
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+public interface CorpMenuMapper {
+
+	/**新增菜单
+	 * @param menu
+	 */
+	void addMenu(Menu menu);
+
+	/**保存修改菜单
+	 * @param menu
+	 */
+	void edit(Menu menu);
+
+	/**
+	 * 通过菜单ID获取数据
+	 * @param pd
+	 * @return
+	 */
+	PageData getMenuById(PageData pd);
+
+	/**获取最大的菜单ID
+	 * @param pd
+	 * @return
+	 */
+	PageData findMaxId(PageData pd);
+
+	/**通过ID获取其子一级菜单
+	 * @param parentId
+	 * @return
+	 */
+	List<Menu> listSubMenuByParentId(String parentId);
+
+	/**获取所有菜单并填充每个菜单的子菜单列表(菜单管理)
+	 * @param MENU_ID
+	 * @return
+	 */
+	List<Menu> listAllMenu(String MENU_ID);
+
+	/**删除菜单
+	 * @param MENU_ID
+	 */
+	void deleteMenuById(String MENU_ID);
+
+	/**保存菜单图标
+	 * @param pd
+	 * @return
+	 */
+	void editicon(PageData pd);
+
+	List<Menu> listSubMenuAll(String MENU_ID);
+}
diff --git a/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpRoleMapper.java b/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpRoleMapper.java
new file mode 100644
index 00000000..fe3585ae
--- /dev/null
+++ b/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpRoleMapper.java
@@ -0,0 +1,110 @@
+package com.zcloud.mapper.datasource.corpsystem;
+
+
+import com.zcloud.entity.Page;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Role;
+
+import java.util.List;
+
+/**
+ * 说明:角色Mapper
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+public interface CorpRoleMapper {
+
+	/**通过角色ID获取数据
+	 * @param pd
+	 * @return
+	 */
+	PageData findById(PageData pd);
+
+	/**通过id查找(返回角色对象)
+	 * @param roleId
+	 * @return
+	 */
+	Role getRoleById(String ROLE_ID);
+
+	/**通过角色编码查找
+	 * @param pd
+	 * @return
+	 */
+	PageData getRoleByRnumber(PageData pd);
+
+	/**通过组ID获取组下级角色列表
+	 * @param pd
+	 * @return
+	 */
+	List<Role> listAllRolesByPId(PageData pd);
+
+	/**添加
+	 * @param pd
+	 */
+	void add(PageData pd);
+
+	/**保存修改
+	 * @param pd
+	 */
+	void edit(PageData pd);
+
+	/**删除角色
+	 * @param ROLE_ID
+	 * @throws Exception
+	 */
+	void deleteRoleById(String ROLE_ID);
+
+	/**给当前角色附加菜单权限
+	 * @param role
+	 * @throws Exception
+	 */
+	void updateRoleRights(Role role);
+
+	/**给全部子角色加菜单权限
+	 * @param pd
+	 * @throws Exception
+	 */
+	void setAllRights(PageData pd);
+
+	/**权限(增删改查)
+	 * @param msg 区分增删改查
+	 * @param pd
+	 * @throws Exception
+	 */
+	void addQx(PageData pd);
+
+	/**权限(增删改查)
+	 * @param msg 区分增删改查
+	 * @param pd
+	 * @throws Exception
+	 */
+	void delQx(PageData pd);
+
+	/**权限(增删改查)
+	 * @param msg 区分增删改查
+	 * @param pd
+	 * @throws Exception
+	 */
+	void editQx(PageData pd);
+
+	/**权限(增删改查)
+	 * @param msg 区分增删改查
+	 * @param pd
+	 * @throws Exception
+	 */
+	void chaQx(PageData pd);
+
+	/**通过角色ID数组获取角色列表
+	 * @param arryROLE_ID
+	 * @throws Exception
+	 */
+	List<Role> listAllRolesByArryROLE_ID(String[] arryROLE_ID);
+
+	/**角色列表(弹窗选择用)
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	List<PageData> roleWindowlistPage(Page page);
+
+}
diff --git a/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpUsersMapper.java b/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpUsersMapper.java
new file mode 100644
index 00000000..3c0bb8d1
--- /dev/null
+++ b/src/main/java/com/zcloud/mapper/datasource/corpsystem/CorpUsersMapper.java
@@ -0,0 +1,130 @@
+package com.zcloud.mapper.datasource.corpsystem;
+
+import com.zcloud.entity.Page;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.User;
+
+import java.util.List;
+
+/**
+ * 说明:用户Mapper
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+public interface CorpUsersMapper {
+
+	/**通过用户获取数据
+	 * @param pd
+	 * @return
+	 */
+	PageData findByUsername(PageData pd);
+
+	/**用户列表
+	 * @param page
+	 * @return
+	 */
+	List<PageData> userlistPage(Page page);
+
+	/**通过用户ID获取用户信息和角色信息
+	 * @param USER_ID
+	 * @return
+	 */
+	User getUserAndRoleById(String USER_ID);
+
+	/**通过邮箱获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	PageData findByEmail(PageData pd);
+
+	/**通过编码获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	PageData findByNumbe(PageData pd);
+
+	/**列出某角色下的所有用户
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	List<PageData> listAllUserByRoldId(PageData pd);
+
+	/**用户列表(全部)
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	List<PageData> listAllUser(PageData pd);
+
+	/**用户列表(弹窗选择用)
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	List<PageData> userBystafflistPage(Page page);
+
+	/**通过用户ID获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	PageData findById(PageData pd);
+
+	/**通过分公司ID获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	PageData findByCorpId(PageData pd);
+
+	/**保存用户IP
+	 * @param pd
+	 */
+	void saveIP(PageData pd);
+
+	/**保存用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	void saveUser(PageData pd);
+	void editPassword(PageData pd);
+
+	/**保存用户系统皮肤
+	 * @param pd
+	 * @throws Exception
+	 */
+	void saveSkin(PageData pd);
+
+	/**修改用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	void editUser(PageData pd);
+
+	/**删除用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	void deleteUser(PageData pd);
+
+	/**批量删除用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	void deleteAllUser(String[] USER_IDS);
+
+	/**修改用户小程序权限
+	 * @param pd
+	 * @throws Exception
+	 */
+	void editUserFuns(PageData pd);
+	Integer hasUserName (PageData pd);
+
+	List<PageData> listUserAndDept (PageData pd);
+	void updateUserStatus (PageData pd);
+
+	void unLockUser(PageData pd);
+}
diff --git a/src/main/java/com/zcloud/service/system/corpsystem/CorpMenuService.java b/src/main/java/com/zcloud/service/system/corpsystem/CorpMenuService.java
new file mode 100644
index 00000000..931731b8
--- /dev/null
+++ b/src/main/java/com/zcloud/service/system/corpsystem/CorpMenuService.java
@@ -0,0 +1,75 @@
+package com.zcloud.service.system.corpsystem;
+
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Menu;
+
+import java.util.List;
+
+/**
+ * 说明:菜单服务接口
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+public interface CorpMenuService {
+
+	/**新增菜单
+	 * @param menu
+	 * @throws Exception
+	 */
+	public void addMenu(Menu menu) throws Exception;
+
+	/**保存修改菜单
+	 * @param menu
+	 * @throws Exception
+	 */
+	public void edit(Menu menu) throws Exception;
+
+	/**获取最大的菜单ID
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findMaxId(PageData pd) throws Exception;
+
+	/**获取所有菜单并填充每个菜单的子菜单列表(系统菜单列表)
+	 * @param MENU_ID
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Menu> listAllMenuQx(String MENU_ID) throws Exception;
+
+	/**通过ID获取其子一级菜单
+	 * @param parentId
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Menu> listSubMenuByParentId(String parentId)throws Exception;
+
+	/**获取所有菜单并填充每个菜单的子菜单列表(菜单管理)(
+	 * @param MENU_ID
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Menu> listAllMenu(String MENU_ID) throws Exception;
+
+	/**获取所有菜单并填充每个菜单的子菜单列表(系统菜单列表)
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData getMenuById(PageData pd) throws Exception;
+
+	/**删除菜单
+	 * @param MENU_ID
+	 * @throws Exception
+	 */
+	public void deleteMenuById(String MENU_ID) throws Exception;
+
+	/**保存菜单图标
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void editicon(PageData pd) throws Exception;
+	public List<Menu> listSubMenuAll()throws Exception;
+
+}
diff --git a/src/main/java/com/zcloud/service/system/corpsystem/CorpRoleService.java b/src/main/java/com/zcloud/service/system/corpsystem/CorpRoleService.java
new file mode 100644
index 00000000..753d1458
--- /dev/null
+++ b/src/main/java/com/zcloud/service/system/corpsystem/CorpRoleService.java
@@ -0,0 +1,94 @@
+package com.zcloud.service.system.corpsystem;
+
+import com.zcloud.entity.Page;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Role;
+
+import java.util.List;
+
+/**
+ * 说明:角色服务接口
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+public interface CorpRoleService {
+
+	/**通过角色ID获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findById(PageData pd)throws Exception;
+
+	/**通过id查找(返回角色对象)
+	 * @param roleId
+	 * @return
+	 * @throws Exception
+	 */
+	public Role getRoleById(String ROLE_ID) throws Exception;
+
+	/**通过组ID获取组下级角色列表
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Role> listAllRolesByPId(PageData pd) throws Exception;
+
+	/**通过角色编码查找
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData getRoleByRnumber(PageData pd) throws Exception;
+
+	/**添加
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void add(PageData pd) throws Exception;
+
+	/**保存修改
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void edit(PageData pd) throws Exception;
+
+	/**删除角色
+	 * @param ROLE_ID
+	 * @throws Exception
+	 */
+	public void deleteRoleById(String ROLE_ID) throws Exception;
+
+	/**给当前角色附加菜单权限
+	 * @param role
+	 * @throws Exception
+	 */
+	public void updateRoleRights(Role role) throws Exception;
+
+	/**给全部子角色加菜单权限
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void setAllRights(PageData pd) throws Exception;
+
+	/**权限(增删改查)
+	 * @param msg 区分增删改查
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void saveB4Button(String msg,PageData pd) throws Exception;
+
+	/**通过角色ID数组获取角色列表
+	 * @param arryROLE_ID
+	 * @throws Exception
+	 */
+	public List<Role> getRoleByArryROLE_ID(String[] arryROLE_ID)throws Exception;
+
+	/**角色列表(弹窗选择用)
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> roleListWindow(Page page)throws Exception;
+
+}
diff --git a/src/main/java/com/zcloud/service/system/corpsystem/CorpUsersService.java b/src/main/java/com/zcloud/service/system/corpsystem/CorpUsersService.java
new file mode 100644
index 00000000..90e57b56
--- /dev/null
+++ b/src/main/java/com/zcloud/service/system/corpsystem/CorpUsersService.java
@@ -0,0 +1,133 @@
+package com.zcloud.service.system.corpsystem;
+
+import com.zcloud.entity.Page;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.User;
+
+import java.util.List;
+
+/**
+ * 说明:用户服务接口
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+public interface CorpUsersService {
+
+	/**通过用户名获取用户信息
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findByUsername(PageData pd)throws Exception;
+
+	/**通过用户ID获取用户信息
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findById(PageData pd)throws Exception;
+
+	/**用户列表
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> userlistPage(Page page)throws Exception;
+
+	/**通过用户ID获取用户信息和角色信息
+	 * @param USER_ID
+	 * @return
+	 * @throws Exception
+	 */
+	public User getUserAndRoleById(String USER_ID) throws Exception;
+
+	/**保存用户IP
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void saveIP(PageData pd)throws Exception;
+
+	/**通过邮箱获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findByEmail(PageData pd)throws Exception;
+
+	/**通过编码获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findByNumbe(PageData pd) throws Exception;
+
+	/**列出某角色下的所有用户
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> listAllUserByRoldId(PageData pd) throws Exception;
+
+	/**用户列表(全部)
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> listAllUser(PageData pd)throws Exception;
+
+	/**用户列表(弹窗选择用)
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> listUsersBystaff(Page page)throws Exception;
+
+	/**保存用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void saveUser(PageData pd)throws Exception;
+
+	/**保存用户系统皮肤
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void saveSkin(PageData pd)throws Exception;
+
+	/**修改用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void editUser(PageData pd)throws Exception;
+	public void editPassword(PageData pd)throws Exception;
+
+	/**删除用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void deleteUser(PageData pd)throws Exception;
+
+	/**批量删除用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void deleteAllUser(String[] USER_IDS)throws Exception;
+
+	/**修改用户小程序权限
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void editUserFuns(PageData pd);
+
+    public Integer hasUserName(PageData pd)throws Exception;
+
+	public List<PageData> listUserAndDept (PageData pd) throws  Exception;
+
+	/***
+	 * 修改用户状态
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public void updateUserStatus (PageData pd) throws  Exception;
+}
diff --git a/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpMenuServiceImpl.java b/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpMenuServiceImpl.java
new file mode 100644
index 00000000..8b09cca3
--- /dev/null
+++ b/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpMenuServiceImpl.java
@@ -0,0 +1,126 @@
+package com.zcloud.service.system.corpsystem.impl;
+
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Menu;
+import com.zcloud.mapper.datasource.corpsystem.CorpMenuMapper;
+import com.zcloud.service.system.corpsystem.CorpMenuService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 说明:菜单服务接口实现类
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+@Service
+@Transactional //开启事物
+public class CorpMenuServiceImpl implements CorpMenuService {
+
+	@Autowired
+	private CorpMenuMapper corpMenuMapper;
+
+	/**新增菜单
+	 * @param menu
+	 * @throws Exception
+	 */
+	@CacheEvict(value="menucache", allEntries=true)
+	public void addMenu(Menu menu) throws Exception{
+		corpMenuMapper.addMenu(menu);
+	}
+
+	/**保存修改菜单
+	 * @param menu
+	 * @throws Exception
+	 */
+	@CacheEvict(value="menucache", allEntries=true)
+	public void edit(Menu menu) throws Exception{
+		corpMenuMapper.edit(menu);
+	}
+
+	/**
+	 * 通过菜单ID获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData getMenuById(PageData pd) throws Exception {
+		return corpMenuMapper.getMenuById(pd);
+	}
+
+	/**获取最大的菜单ID
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findMaxId(PageData pd) throws Exception{
+		return corpMenuMapper.findMaxId(pd);
+	}
+
+	/**
+	 * 通过ID获取其子一级菜单
+	 * @param parentId
+	 * @return
+	 * @throws Exception
+	 */
+	@Cacheable(key="'menu-'+#parentId",value="menucache")
+	public List<Menu> listSubMenuByParentId(String parentId) throws Exception {
+		return corpMenuMapper.listSubMenuByParentId(parentId);
+	}
+
+	/**
+	 * 获取所有菜单并填充每个菜单的子菜单列表(菜单管理)(递归处理)
+	 * @param MENU_ID
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Menu> listAllMenu(String MENU_ID) throws Exception {
+		List<Menu> menuList = this.listSubMenuByParentId(MENU_ID);
+		for(Menu menu : menuList){
+			menu.setMENU_URL("menu_edit.html?MENU_ID="+menu.getMENU_ID());
+			menu.setSubMenu(this.listAllMenu(menu.getMENU_ID()));
+			menu.setTarget("treeFrame");
+		}
+		return menuList;
+	}
+
+	/**
+	 * 获取所有菜单并填充每个菜单的子菜单列表(系统菜单列表)(递归处理)
+	 * @param MENU_ID
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Menu> listAllMenuQx(String MENU_ID) throws Exception {
+		List<Menu> menuList = this.listSubMenuByParentId(MENU_ID);
+		for(Menu menu : menuList){
+			menu.setSubMenu(this.listAllMenuQx(menu.getMENU_ID()));
+			menu.setTarget("treeFrame");
+		}
+		return menuList;
+	}
+
+	/**删除菜单
+	 * @param MENU_ID
+	 * @throws Exception
+	 */
+	@CacheEvict(value="menucache", allEntries=true)
+	public void deleteMenuById(String MENU_ID) throws Exception{
+		corpMenuMapper.deleteMenuById(MENU_ID);
+	}
+
+	/**保存菜单图标
+	 * @param pd
+	 * @throws Exception
+	 */
+	@CacheEvict(value="menucache", allEntries=true)
+	public void editicon(PageData pd) throws Exception{
+		corpMenuMapper.editicon(pd);
+	}
+	public List<Menu> listSubMenuAll()throws Exception{
+		return corpMenuMapper.listSubMenuAll("");
+	}
+}
diff --git a/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpRoleServiceImpl.java b/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpRoleServiceImpl.java
new file mode 100644
index 00000000..1f4442cc
--- /dev/null
+++ b/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpRoleServiceImpl.java
@@ -0,0 +1,136 @@
+package com.zcloud.service.system.corpsystem.impl;
+
+import com.zcloud.entity.Page;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.Role;
+import com.zcloud.mapper.datasource.corpsystem.CorpRoleMapper;
+import com.zcloud.service.system.corpsystem.CorpRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 说明:角色服务接口实现类
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+@Service
+@Transactional //开启事物
+public class CorpRoleServiceImpl implements CorpRoleService {
+
+	@Autowired
+	private CorpRoleMapper corpRoleMapper;
+
+	/**通过角色ID获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findById(PageData pd) throws Exception {
+		return corpRoleMapper.findById(pd);
+	}
+
+	/**通过id查找(返回角色对象)
+	 * @param roleId
+	 * @return
+	 * @throws Exception
+	 */
+	public Role getRoleById(String ROLE_ID) throws Exception{
+		return corpRoleMapper.getRoleById(ROLE_ID);
+	}
+
+	/**通过角色编码查找
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData getRoleByRnumber(PageData pd) throws Exception{
+		return corpRoleMapper.getRoleByRnumber(pd);
+	}
+
+	/**通过组ID获取组下级角色列表
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public List<Role> listAllRolesByPId(PageData pd) throws Exception {
+		return corpRoleMapper.listAllRolesByPId(pd);
+	}
+
+	/**添加
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void add(PageData pd) throws Exception{
+		corpRoleMapper.add( pd);
+	}
+
+	/**保存修改
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void edit(PageData pd) throws Exception{
+		corpRoleMapper.edit( pd);
+	}
+
+	/**删除角色
+	 * @param ROLE_ID
+	 * @throws Exception
+	 */
+	public void deleteRoleById(String ROLE_ID) throws Exception{
+		corpRoleMapper.deleteRoleById(ROLE_ID);
+	}
+
+	/**给当前角色附加菜单权限
+	 * @param role
+	 * @throws Exception
+	 */
+	public void updateRoleRights(Role role) throws Exception{
+		corpRoleMapper.updateRoleRights(role);
+	}
+
+	/**给全部子角色加菜单权限
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void setAllRights(PageData pd) throws Exception{
+		corpRoleMapper.setAllRights(pd);
+	}
+
+	/**权限(增删改查)
+	 * @param msg 区分增删改查
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void saveB4Button(String msg,PageData pd) throws Exception{
+		if("add_qx".equals(msg)){
+			corpRoleMapper.addQx(pd);
+		}else if("del_qx".equals(msg)){
+			corpRoleMapper.delQx(pd);
+		}else if("edit_qx".equals(msg)){
+			corpRoleMapper.editQx(pd);
+		}else if("cha_qx".equals(msg)){
+			corpRoleMapper.chaQx(pd);
+		}
+	}
+
+	/**通过角色ID数组获取角色列表
+	 * @param arryROLE_ID
+	 * @throws Exception
+	 */
+	public List<Role> getRoleByArryROLE_ID(String[] arryROLE_ID)throws Exception{
+		return corpRoleMapper.listAllRolesByArryROLE_ID(arryROLE_ID);
+	}
+
+	/**角色列表(弹窗选择用)
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> roleListWindow(Page page)throws Exception{
+		return corpRoleMapper.roleWindowlistPage(page);
+	}
+
+}
diff --git a/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpUsersServiceImpl.java b/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpUsersServiceImpl.java
new file mode 100644
index 00000000..ccc6e72a
--- /dev/null
+++ b/src/main/java/com/zcloud/service/system/corpsystem/impl/CorpUsersServiceImpl.java
@@ -0,0 +1,177 @@
+package com.zcloud.service.system.corpsystem.impl;
+
+import com.zcloud.entity.Page;
+import com.zcloud.entity.PageData;
+import com.zcloud.entity.system.User;
+import com.zcloud.mapper.datasource.corpsystem.CorpUsersMapper;
+import com.zcloud.service.system.corpsystem.CorpUsersService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 说明:用户服务接口实现类
+ * 作者:luoxiaobao
+ * 官网:www.qdkjchina.com
+ */
+@Service
+@Transactional //开启事物
+public class CorpUsersServiceImpl implements CorpUsersService {
+
+	@Autowired
+	private CorpUsersMapper corpUsersMapper;
+
+	/**通过用户名获取用户信息
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findByUsername(PageData pd) throws Exception {
+		return	corpUsersMapper.findByUsername(pd);
+	}
+
+	/**通过用户ID获取用户信息
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findById(PageData pd)throws Exception{
+		return	corpUsersMapper.findById(pd);
+	}
+
+	/**用户列表
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> userlistPage(Page page) throws Exception {
+		return	corpUsersMapper.userlistPage(page);
+	}
+
+	/**通过用户ID获取用户信息和角色信息
+	 * @param USER_ID
+	 * @return
+	 * @throws Exception
+	 */
+	public User getUserAndRoleById(String USER_ID) throws Exception {
+		return	corpUsersMapper.getUserAndRoleById(USER_ID);
+	}
+
+	/**保存用户IP
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void saveIP(PageData pd) throws Exception {
+		corpUsersMapper.saveIP(pd);
+	}
+
+	/**通过邮箱获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findByEmail(PageData pd) throws Exception {
+		return corpUsersMapper.findByEmail(pd);
+	}
+
+	/**通过编码获取数据
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public PageData findByNumbe(PageData pd) throws Exception {
+		return corpUsersMapper.findByNumbe(pd);
+	}
+
+	/**列出某角色下的所有用户
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> listAllUserByRoldId(PageData pd) throws Exception{
+		return corpUsersMapper.listAllUserByRoldId(pd);
+	}
+
+	/**用户列表(全部)
+	 * @param pd
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> listAllUser(PageData pd)throws Exception{
+		return corpUsersMapper.listAllUser(pd);
+	}
+
+	/**用户列表(弹窗选择用)
+	 * @param page
+	 * @return
+	 * @throws Exception
+	 */
+	public List<PageData> listUsersBystaff(Page page)throws Exception{
+		return corpUsersMapper.userBystafflistPage(page);
+	}
+
+	/**保存用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void saveUser(PageData pd)throws Exception {
+		corpUsersMapper.saveUser(pd);
+	}
+
+	/**保存用户系统皮肤
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void saveSkin(PageData pd)throws Exception{
+		corpUsersMapper.saveSkin(pd);
+	}
+
+	/**修改用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void editUser(PageData pd)throws Exception{
+		corpUsersMapper.editUser(pd);
+	}
+	public void editPassword(PageData pd)throws Exception{
+		corpUsersMapper.editPassword(pd);
+	}
+
+	/**删除用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void deleteUser(PageData pd)throws Exception{
+		corpUsersMapper.deleteUser(pd);
+	}
+
+	/**批量删除用户
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void deleteAllUser(String[] USER_IDS)throws Exception{
+		corpUsersMapper.deleteAllUser(USER_IDS);
+	}
+
+	/**修改用户小程序权限
+	 * @param pd
+	 * @throws Exception
+	 */
+	public void editUserFuns(PageData pd) {
+		corpUsersMapper.editUserFuns(pd);
+	}
+
+    @Override
+    public Integer hasUserName(PageData pd) throws Exception {
+        return corpUsersMapper.hasUserName(pd);
+    }
+
+    public List<PageData> listUserAndDept (PageData pd) throws  Exception{
+        return corpUsersMapper.listUserAndDept(pd);
+    }
+	public void updateUserStatus (PageData pd) throws  Exception{
+		corpUsersMapper.updateUserStatus(pd);
+	}
+}
diff --git a/src/main/java/com/zcloud/util/Const.java b/src/main/java/com/zcloud/util/Const.java
index b1d017c3..f3c56e21 100644
--- a/src/main/java/com/zcloud/util/Const.java
+++ b/src/main/java/com/zcloud/util/Const.java
@@ -8,6 +8,8 @@ package com.zcloud.util;
 public class Const {
 
 	public static final String SESSION_USER = "SESSION_USER";						//session用的用户
+	public static final String SESSION_DEPT = "SESSION_DEPT";						//session用的用户
+
 	public static final String SESSION_USERROL = "SESSION_USERROL";					//用户对象(包含角色信息)
 	public static final String SESSION_ROLE_RIGHTS = "SESSION_ROLE_RIGHTS";			//角色菜单权限
 	public static final String SHIROSET = "SHIROSET";								//菜单权限标识
diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties
index 5bb49ecc..e9b3d2d3 100644
--- a/src/main/resources/application-dev.properties
+++ b/src/main/resources/application-dev.properties
@@ -1,13 +1,13 @@
 
 
 datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver
-datasource.no1.url=jdbc:mysql://39.101.130.96:33068/qa-gwj-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
+datasource.no1.url=jdbc:mysql://192.168.0.17:3306/qa-gwj-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
 datasource.no1.username=root
-datasource.no1.password=Mysql@zcloud88888
+datasource.no1.password=root
 datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver
-datasource.no2.url=jdbc:mysql://39.101.130.96:33068/qa-gwj-regulatory?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
+datasource.no2.url=jdbc:mysql://192.168.0.17:3306/qa-gwj-regulatory?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
 datasource.no2.username=root
-datasource.no2.password=Mysql@zcloud88888
+datasource.no2.password=root
 
 
 #druid???
diff --git a/src/main/resources/mybatis/datasource/corpsystem/CorpMenuMapper.xml b/src/main/resources/mybatis/datasource/corpsystem/CorpMenuMapper.xml
new file mode 100644
index 00000000..24f3cd6b
--- /dev/null
+++ b/src/main/resources/mybatis/datasource/corpsystem/CorpMenuMapper.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zcloud.mapper.datasource.corpsystem.CorpMenuMapper">
+
+	<resultMap type="Menu" id="menuResultMap">
+		<id column="MENU_ID" property="MENU_ID"/>
+		<result column="MENU_NAME" property="MENU_NAME"/>
+		<result column="MENU_URL" property="MENU_URL"/>
+		<result column="PARENT_ID" property="PARENT_ID"/>
+		<result column="MENU_ORDER" property="MENU_ORDER"/>
+		<result column="MENU_ICON" property="MENU_ICON"/>
+		<result column="MENU_TYPE" property="MENU_TYPE"/>
+		<result column="SHIRO_KEY" property="SHIRO_KEY"/>
+		<result column="COMPONENT" property="COMPONENT"/>
+		<result column="SHOW_MODEL" property="SHOW_MODEL"/>
+	</resultMap>
+
+	<!-- ztree -->
+	<resultMap type="Menu" id="menuZtreeResultMap">
+		<id column="MENU_ID" property="MENU_ID"/>
+		<result column="MENU_NAME" property="MENU_NAME"/>
+		<result column="MENU_URL" property="MENU_URL"/>
+		<result column="PARENT_ID" property="PARENT_ID"/>
+		<result column="MENU_ORDER" property="MENU_ORDER"/>
+		<result column="MENU_ICON" property="MENU_ICON"/>
+		<result column="MENU_TYPE" property="MENU_TYPE"/>
+		<result column="SHIRO_KEY" property="SHIRO_KEY"/>
+		<result column="COMPONENT" property="COMPONENT"/>
+		<result column="SHOW_MODEL" property="SHOW_MODEL"/>
+		<result column="target" property="target"></result>
+	</resultMap>
+
+	<!--表名 -->
+	<sql id="tableName">
+		SYS_MENU
+	</sql>
+
+	<!-- 字段 -->
+	<sql id="Field">
+		MENU_ID,
+ 		MENU_NAME,
+ 		MENU_URL,
+ 		PARENT_ID,
+ 		MENU_ICON,
+ 		SHIRO_KEY,
+ 		MENU_ORDER,
+ 		MENU_STATE,
+ 		MENU_TYPE,
+ 		COMPONENT,
+ 		SHOW_MODEL
+	</sql>
+
+	<!-- 字段值 -->
+	<sql id="FieldValue">
+		#{MENU_ID},
+ 		#{MENU_NAME},
+ 		#{MENU_URL},
+ 		#{PARENT_ID},
+ 		#{MENU_ICON},
+ 		#{SHIRO_KEY},
+ 		#{MENU_ORDER},
+ 		#{MENU_STATE},
+ 		#{MENU_TYPE},
+ 		#{COMPONENT},
+ 		#{SHOW_MODEL}
+	</sql>
+
+	<!--新增 -->
+	<insert id="addMenu" parameterType="menu">
+		insert into
+			<include refid="tableName"></include>
+		(
+			<include refid="Field"></include>
+		) values (
+			<include refid="FieldValue"></include>
+		)
+	</insert>
+
+	<!--编辑 -->
+	<update id="edit" parameterType="menu">
+		update
+		<include refid="tableName"></include>
+		set
+			MENU_NAME =#{MENU_NAME},
+			MENU_URL  =#{MENU_URL} ,
+			MENU_ORDER=#{MENU_ORDER},
+			MENU_STATE=#{MENU_STATE},
+			SHIRO_KEY=#{SHIRO_KEY},
+			MENU_TYPE =#{MENU_TYPE},
+			COMPONENT=#{COMPONENT},
+			SHOW_MODEL=#{SHOW_MODEL}
+		where
+			MENU_ID=#{MENU_ID}
+	</update>
+
+	<!--通过菜单ID获取数据 -->
+	<select id="getMenuById" parameterType="pd" resultType="pd">
+		select
+			<include refid="Field"></include>
+		 from
+			<include refid="tableName"></include>
+		 where MENU_ID=#{MENU_ID}
+	</select>
+
+	<!--取最大ID-->
+	<select id="findMaxId" parameterType="pd" resultType="pd">
+		select MAX(MENU_ID) MID from
+		<include refid="tableName"></include>
+	</select>
+
+	<!--通过ID获取其子一级菜单 -->
+	<select id="listSubMenuByParentId" parameterType="String" resultMap="menuResultMap">
+		select
+			<include refid="Field"></include>
+		from
+			<include refid="tableName"></include>
+		where PARENT_ID = #{parentId} order by (MENU_ORDER+0)
+	</select>
+
+	<!--删除菜单-->
+	<delete id="deleteMenuById" parameterType="String">
+		delete from
+		<include refid="tableName"></include>
+		where MENU_ID=#{MENU_ID}
+	</delete>
+
+	<!--保存菜单图标  -->
+	<update id="editicon" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set
+			MENU_ICON=#{MENU_ICON}
+		where
+			MENU_ID=#{MENU_ID}
+	</update>
+	<!--通过ID获取其子一级菜单 -->
+	<select id="listSubMenuAll" parameterType="String" resultMap="menuResultMap">
+		select
+		<include refid="Field"></include>
+		from
+		<include refid="tableName"></include>
+		where MENU_STATE = 1 order by (MENU_ORDER+0)
+	</select>
+</mapper>
diff --git a/src/main/resources/mybatis/datasource/corpsystem/CorpRoleMapper.xml b/src/main/resources/mybatis/datasource/corpsystem/CorpRoleMapper.xml
new file mode 100644
index 00000000..00d9bf33
--- /dev/null
+++ b/src/main/resources/mybatis/datasource/corpsystem/CorpRoleMapper.xml
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zcloud.mapper.datasource.corpsystem.CorpRoleMapper">
+
+	<resultMap type="Role" id="roleResultMap">
+		<id column="ROLE_ID" property="ROLE_ID" />
+		<result column="ROLE_NAME" property="ROLE_NAME" />
+		<result column="RIGHTS" property="RIGHTS" />
+		<result column="DEPT_TYPE" property="DEPT_TYPE" />
+
+	</resultMap>
+
+	<!--表名 -->
+	<sql id="tableName">
+		SYS_ROLE
+	</sql>
+
+	<!-- 字段 -->
+	<sql id="Field">
+		ROLE_ID,
+		ROLE_NAME,
+		RIGHTS,
+		PARENT_ID,
+		ADD_QX,
+		DEL_QX,
+		EDIT_QX,
+		CHA_QX,
+		DEPT_TYPE,
+		RNUMBER,
+		LEVEL,
+        PRIMARYNUM
+	</sql>
+
+	<!-- 字段值 -->
+	<sql id="FieldValue">
+		#{ROLE_ID},
+		#{ROLE_NAME},
+		#{RIGHTS},
+		#{PARENT_ID},
+		#{ADD_QX},
+		#{DEL_QX},
+		#{EDIT_QX},
+		#{CHA_QX},
+		#{DEPT_TYPE},
+		#{RNUMBER},
+		#{LEVEL},
+		#{PRIMARYNUM}
+	</sql>
+
+	<!-- 通过id查找 -->
+	<select id="findById" parameterType="pd" resultType="pd">
+		select
+		<include refid="Field"></include>
+		from
+		<include refid="tableName"></include>
+		where ROLE_ID = #{ROLE_ID}
+	</select>
+
+	<!-- 通过id查找 返回角色对象)-->
+	<select id="getRoleById" parameterType="String" resultMap="roleResultMap">
+		select * from
+		<include refid="tableName"></include>
+		where ROLE_ID=#{ROLE_ID}
+	</select>
+
+	<!-- 通过编码查找 -->
+	<select id="getRoleByRnumber" parameterType="pd" resultType="pd">
+		select
+		<include refid="Field"></include>
+		from
+		<include refid="tableName"></include>
+		where RNUMBER = #{RNUMBER}
+	</select>
+
+	<!-- 列出此组下的角色 -->
+	<select id="listAllRolesByPId" resultMap="roleResultMap">
+		select
+		<include refid="Field"></include>
+		from
+		<include refid="tableName"></include>
+		where
+			PARENT_ID = #{ROLE_ID}
+		ORDER BY RNUMBER
+	</select>
+
+	<!-- 添加 -->
+	<insert id="add" parameterType="pd">
+		insert into
+		<include refid="tableName"></include>
+		(
+		<include refid="Field"></include>
+		) values (
+		<include refid="FieldValue"></include>
+		)
+	</insert>
+
+	<!-- 保存修改 -->
+	<update id="edit" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set ROLE_NAME = #{ROLE_NAME},
+		DEPT_TYPE = #{DEPT_TYPE},
+		PRIMARYNUM = #{PRIMARYNUM},
+		LEVEL = #{LEVEL}
+		where ROLE_ID = #{ROLE_ID}
+	</update>
+
+	<!-- 删除角色  -->
+	<delete id="deleteRoleById" parameterType="String">
+		delete from
+		<include refid="tableName"></include>
+		where ROLE_ID=#{ROLE_ID}
+	</delete>
+
+	<!-- 给当前角色附加菜单权限  -->
+	<update id="updateRoleRights" parameterType="role">
+		update
+		<include refid="tableName"></include>
+		set RIGHTS=#{RIGHTS}
+		where ROLE_ID=#{ROLE_ID}
+	</update>
+
+	<!-- 给全部子角色加菜单权限 -->
+	<update id="setAllRights" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set RIGHTS=#{rights}
+		where PARENT_ID=#{ROLE_ID}
+	</update>
+
+	<!-- 新增权限 -->
+	<update id="addQx" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set ADD_QX=#{value}
+		where ROLE_ID=#{ROLE_ID}
+	</update>
+
+	<!-- 删除权限 -->
+	<update id="delQx" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set DEL_QX=#{value}
+		where ROLE_ID=#{ROLE_ID}
+	</update>
+
+	<!-- 修改权限 -->
+	<update id="editQx" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set EDIT_QX=#{value}
+		where ROLE_ID=#{ROLE_ID}
+	</update>
+
+	<!-- 查看权限 -->
+	<update id="chaQx" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set CHA_QX=#{value}
+		where ROLE_ID=#{ROLE_ID}
+	</update>
+
+	<!-- 通过角色ID数组获取角色列表 -->
+	<select id="listAllRolesByArryROLE_ID" parameterType="String" resultType="Role" >
+		select
+			RNUMBER
+		from
+			<include refid="tableName"></include>
+		where
+			ROLE_ID in
+  			 <foreach item="item" index="index" collection="array" open="(" separator="," close=")">
+                  #{item}
+             </foreach>
+	</select>
+
+	<!-- 角色列表(弹窗选择用) -->
+	<select id="roleWindowlistPage" parameterType="page" resultType="pd">
+		select
+		<include refid="Field"></include>
+		from
+		<include refid="tableName"></include>
+		where 1=1
+		<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
+			and
+				(
+					ROLE_NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+				or
+					RNUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+				)
+		</if>
+		<if test="pd.ROLE_ID != null and pd.ROLE_ID != ''">
+			and PARENT_ID = #{pd.ROLE_ID}
+		</if>
+		ORDER BY RNUMBER
+	</select>
+
+</mapper>
diff --git a/src/main/resources/mybatis/datasource/corpsystem/CorpUsersMapper.xml b/src/main/resources/mybatis/datasource/corpsystem/CorpUsersMapper.xml
new file mode 100644
index 00000000..63d5f9de
--- /dev/null
+++ b/src/main/resources/mybatis/datasource/corpsystem/CorpUsersMapper.xml
@@ -0,0 +1,549 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+		PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+		"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zcloud.mapper.datasource.corpsystem.CorpUsersMapper">
+
+	<resultMap type="User" id="userAndRoleResultMap">
+		<id column="USER_ID" property="USER_ID"/>
+		<result column="USERNAME" property="USERNAME"/>
+		<result column="PASSWORD" property="PASSWORD"/>
+		<result column="NAME" property="NAME"/>
+		<result column="LAST_LOGIN" property="LAST_LOGIN"/>
+		<result column="IP" property="IP"/>
+		<result column="STATUS" property="STATUS"/>
+		<result column="SKIN" property="SKIN"/>
+		<result column="ROLE_IDS" property="ROLE_IDS"/>
+		<association property="role" column="ROLE_ID" javaType="Role">
+			<id column="ROLE_ID" property="ROLE_ID"/>
+			<result column="ROLE_NAME" property="ROLE_NAME"/>
+			<result column="ROLE_RIGHTS" property="RIGHTS"/>
+			<result column="ADD_QX" property="ADD_QX"/>
+			<result column="DEL_QX" property="DEL_QX"/>
+			<result column="EDIT_QX" property="EDIT_QX"/>
+			<result column="CHA_QX" property="CHA_QX"/>
+		</association>
+	</resultMap>
+	<resultMap type="User" id="userResultMap">
+		<id column="USER_ID" property="USER_ID"/>
+		<result column="USERNAME" property="USERNAME"/>
+		<result column="PASSWORD" property="PASSWORD"/>
+		<result column="NAME" property="NAME"/>
+		<result column="LAST_LOGIN" property="LAST_LOGIN"/>
+		<result column="IP" property="IP"/>
+		<result column="STATUS" property="STATUS"/>
+		<result column="ROLE_ID" property="ROLE_ID"/>
+		<result column="SKIN" property="SKIN"/>
+		<result column="ROLE_IDS" property="ROLE_IDS"/>
+	</resultMap>
+
+	<!--用户表名 -->
+	<sql id="tableName">
+		SYS_USER
+	</sql>
+
+	<!--角色表名 -->
+	<sql id="roleTableName">
+		SYS_ROLE
+	</sql>
+
+	<!-- 字段 -->
+	<sql id="Field">
+		USER_ID,
+		USERNAME,
+		PASSWORD,
+		NAME,
+		ROLE_ID,
+		LAST_LOGIN,
+		IP,
+		STATUS,
+		BZ,
+		SKIN,
+		EMAIL,
+		NUMBER,
+		PHONE,
+		ROLE_IDS,
+		FUN_IDS,
+		TYPE,
+		LEVEL,
+		PROVINCE,
+		CITY,
+		COUNTRY,
+		VILLAGE,
+		SEX,
+		SORT,
+		JOB_LEVEL,
+		JOB
+	</sql>
+
+	<!-- 字段值 -->
+	<sql id="FieldValue">
+		#{USER_ID},
+		#{USERNAME},
+		#{PASSWORD},
+		#{NAME},
+		#{ROLE_ID},
+		#{LAST_LOGIN},
+		#{IP},
+		#{STATUS},
+		#{BZ},
+		#{SKIN},
+		#{EMAIL},
+		#{NUMBER},
+		#{PHONE},
+		#{ROLE_IDS},
+		#{DEPARTMENT_ID},
+		#{FUN_IDS},
+		#{TYPE},
+		#{LEVEL},
+		#{PROVINCE},
+		#{CITY},
+		#{COUNTRY},
+		#{VILLAGE},
+		#{SEX},
+		#{SORT},
+		#{JOB_LEVEL},
+		#{JOB}
+	</sql>
+
+	<!-- 通过USERNAME获取数据 -->
+	<select id="findByUsername" parameterType="pd" resultType="pd">
+		select
+		<include refid="Field"></include>
+		from
+		<include refid="tableName"></include>
+		where
+		USERNAME = #{USERNAME}
+		<if test="USER_ID != null and USER_ID != ''">
+			and USER_ID != #{USER_ID}
+		</if>
+	</select>
+
+	<!-- 通过用户ID获取数据 -->
+	<select id="findById" parameterType="pd" resultType="pd">
+		select
+		*
+		from
+		<include refid="tableName"></include>
+		where
+		USER_ID = #{USER_ID}
+	</select>
+
+	<!-- 通过分公司ID获取数据 -->
+	<select id="findByCorpId" parameterType="pd" resultType="pd">
+		select
+		USER_ID,USERNAME,PASSWORD,NAME
+		from
+		<include refid="tableName"></include>
+		where
+		CORPINFO_ID = #{CORPINFO_ID}
+		and ISMAIN = '1'
+	</select>
+
+	<!-- 通过邮箱获取数据 -->
+	<select id="findByEmail" parameterType="pd" resultType="pd">
+		select
+		<include refid="Field"></include>
+		from
+		<include refid="tableName"></include>
+		where
+		EMAIL = #{EMAIL}
+		<if test="USERNAME != null and USERNAME != ''">
+			and USERNAME != #{USERNAME}
+		</if>
+	</select>
+
+	<!-- 通过编码获取数据 -->
+	<select id="findByNumbe" parameterType="pd" resultType="pd">
+		select
+		<include refid="Field"></include>
+		from
+		<include refid="tableName"></include>
+		where
+		NUMBER = #{NUMBER}
+		<if test="USERNAME != null and USERNAME != ''">
+			and USERNAME != #{USERNAME}
+		</if>
+	</select>
+
+	<!-- 列出某角色下的所有用户 -->
+	<select id="listAllUserByRoldId" parameterType="pd" resultType="pd">
+		select USER_ID
+		from
+		<include refid="tableName"></include>
+		where
+		ROLE_ID = #{ROLE_ID}
+	</select>
+
+	<!-- 新增用户 -->
+	<insert id="saveUser" parameterType="pd">
+		insert into <include refid="tableName"></include> (
+		<include refid="Field"></include>
+		) values (
+		<include refid="FieldValue"></include>
+		)
+	</insert>
+
+	<!-- 修改 -->
+	<update id="editUser" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set NAME = #{NAME},
+		DEPARTMENT_ID = #{DEPARTMENT_ID},
+		ROLE_ID = #{ROLE_ID},
+		ROLE_IDS = #{ROLE_IDS},
+		BZ = #{BZ},
+		EMAIL = #{EMAIL},
+		NUMBER = #{NUMBER},
+		PHONE = #{PHONE},
+		LEVEL=#{LEVEL},
+		TYPE=#{TYPE},
+		PROVINCE=#{PROVINCE},
+		CITY=#{CITY},
+		COUNTRY=#{COUNTRY},
+		VILLAGE=#{VILLAGE}
+		<if test="PASSWORD != null and PASSWORD != ''">
+			,PASSWORD = #{PASSWORD}
+		</if>
+		where
+		USER_ID = #{USER_ID}
+	</update>
+	<update id="editPassword" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set PASSWORD = #{PASSWORD}
+		where
+		USER_ID = #{USER_ID}
+	</update>
+
+	<!-- 用户列表 -->
+	<select id="userlistPage" parameterType="page" resultType="pd">
+		select u.USER_ID,
+		u.USERNAME,
+		u.PASSWORD,
+		u.LAST_LOGIN,
+		u.NAME,
+		u.IP,
+		u.EMAIL,
+		u.NUMBER,
+		u.PHONE,
+		u.PROVINCE,
+		u.CITY,
+		u.COUNTRY,
+		u.VILLAGE,
+		u.TYPE,
+		u.DEPARTMENT_ID,
+		r.ROLE_NAME,
+		u.ROLE_ID,
+		d.NAME as DEPARTMENT_NAME,
+		u.LEVEL,
+		u.SEX,
+		deptLeven.name as jobLevenName,
+		d.LEVEL as deptTypeID ,
+		u.JOB_LEVEL,
+		u.JOB,
+		u.BZ,
+		u.SORT,
+		u.STATUS
+		from <include refid="tableName"></include> u
+		left join SYS_ROLE r on u.ROLE_ID = r.ROLE_ID
+		left join SYS_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
+		left join `qa-gwj-prevention`.sys_dictionaries deptLeven on deptLeven.DICTIONARIES_ID=u.JOB_LEVEL
+		where
+		u.USERNAME != 'admin'
+		and r.PARENT_ID = '1'
+		<if test="pd.KEYWORDS!= null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
+			and
+			(
+			u.USERNAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			or
+			u.EMAIL LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			or
+			u.NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			or
+			u.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			or
+			u.PHONE LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			)
+		</if>
+		<if test="pd.ROLE_ID != null and pd.ROLE_ID != ''">        <!-- 角色检索 -->
+			and u.ROLE_ID=#{pd.ROLE_ID}
+		</if>
+		<if test="pd.STRARTTIME!=null and pd.STRARTTIME!=''">    <!-- 登录时间检索 -->
+			and u.LAST_LOGIN &gt;= #{pd.STRARTTIME}
+		</if>
+		<if test="pd.ENDTIME!=null and pd.ENDTIME!=''">            <!-- 登录时间检索 -->
+			and u.LAST_LOGIN &lt;= #{pd.ENDTIME}
+		</if>
+		<if test="pd.DEPARTMENT_ID!=null and pd.DEPARTMENT_ID!=''">            <!-- 登录时间检索 -->
+			and u.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
+		</if>
+		<if test="pd.PROVINCE != null and pd.PROVINCE != ''">
+			and d.PROVINCE = #{pd.PROVINCE}
+		</if>
+		<if test="pd.CITY != null and pd.CITY != ''"><!-- 检索 -->
+			and d.CITY = #{pd.CITY}
+		</if>
+		<if test="pd.COUNTRY != null and pd.COUNTRY != ''"><!-- 检索 -->
+			and d.COUNTRY = #{pd.COUNTRY}
+		</if>
+		<if test="pd.VILLAGE != null and pd.VILLAGE != ''"><!-- 检索 -->
+			and d.VILLAGE = #{pd.VILLAGE}
+		</if>
+
+		<if test="pd.keyUserName != null and pd.keyUserName != ''"><!-- 用户名称 -->
+			and ( u.USERNAME LIKE CONCAT(CONCAT('%', #{pd.keyUserName}),'%'))
+		</if>
+		<if test="pd.keyDeptLeven != null and pd.keyDeptLeven != ''"><!-- 部门级别 -->
+			and d.LEVEL = #{pd.keyDeptLeven}
+		</if>
+		<if test="pd.keyDeptType != null and pd.keyDeptType != ''"><!-- 单位类型 -->
+			and d.UNITTYPE = #{pd.keyDeptType}
+		</if>
+		<if test="pd.keyDepeName != null and pd.keyDepeName != ''"><!-- 部门名称 -->
+			and ( d.NAME LIKE CONCAT(CONCAT('%', #{pd.keyDepeName}),'%'))
+		</if>
+		<if test="pd.keyJobLeven != null and pd.keyJobLeven != ''"><!-- 职务级别 -->
+			and u.JOB_LEVEL = #{pd.keyJobLeven}
+		</if>
+		order by u.LAST_LOGIN desc
+	</select>
+
+	<!-- 用户列表(全部) -->
+	<select id="listAllUser" parameterType="pd" resultType="pd">
+		select u.USER_ID,
+		u.USERNAME,
+		u.PASSWORD,
+		u.LAST_LOGIN,
+		u.NAME,
+		u.IP,
+		u.EMAIL,
+		u.NUMBER,
+		u.PHONE,
+		r.ROLE_ID,
+		r.ROLE_NAME
+		from <include refid="tableName"></include> u, <include refid="roleTableName"></include> r
+		where u.ROLE_ID = r.ROLE_ID
+		and u.USERNAME != 'admin'
+		and  u.ISDELETE = '0'
+		 and u.CORPINFO_ID in (select CORPINFO_ID from bus_corp_info where ISDELETE = '0')
+		<!-- and r.PARENT_ID = '1' -->
+		<if test="KEYWORDS != null and KEYWORDS != ''"><!-- 关键词检索 -->
+			and
+			(
+			u.USERNAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
+			or
+			u.EMAIL LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
+			or
+			u.NUMBER LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
+			or
+			u.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
+			or
+			u.PHONE LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
+			)
+		</if>
+		<if test="ROLE_ID != null and ROLE_ID != ''"><!-- 角色检索 -->
+			and u.ROLE_ID=#{ROLE_ID}
+		</if>
+		<if test="STRARTTIME!=null and STRARTTIME!=''"><!-- 登录时间检索 -->
+			and u.LAST_LOGIN &gt;= #{STRARTTIME}
+		</if>
+		<if test="ENDTIME!=null and ENDTIME!=''"><!-- 登录时间检索 -->
+			and u.LAST_LOGIN &lt;= #{ENDTIME}
+		</if>
+		<if test="PRECINCT_ID != null and PRECINCT_ID != ''"><!-- 关键词检索 -->
+			AND
+			u.PRECINCT_ID = #{PRECINCT_ID}
+		</if>
+		<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''"><!-- 用户部门 -->
+			AND  u.DEPARTMENT_ID = #{DEPARTMENT_ID}
+		</if>
+		<if test="NOMAIN != null and NOMAIN != ''"><!-- 关键词检索 -->
+			AND u.ISMAIN != '1'
+		</if>
+		order by u.LAST_LOGIN desc
+	</select>
+
+	<!-- 通过用户ID获取用户信息和角色信息 -->
+	<select id="getUserAndRoleById" parameterType="String" resultMap="userAndRoleResultMap">
+		select u.USER_ID,
+		u.USERNAME,
+		u.NAME,
+		u.PASSWORD,
+		u.SKIN,
+		u.NUMBER,
+		u.ROLE_IDS,
+		r.ROLE_ID,
+		r.ROLE_NAME,
+		r.RIGHTS as ROLE_RIGHTS,
+		r.ADD_QX,
+		r.DEL_QX,
+		r.EDIT_QX,
+		r.CHA_QX
+		from
+		<include refid="tableName"></include>
+		u
+		left join
+		<include refid="roleTableName"></include>
+		r
+		on u.ROLE_ID=r.ROLE_ID
+		where u.STATUS=0
+		and u.USER_ID=#{USER_ID}
+	</select>
+
+	<!-- 存入IP -->
+	<update id="saveIP" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set
+		IP = #{IP},
+		LAST_LOGIN = #{LAST_LOGIN}
+		where
+		USERNAME = #{USERNAME}
+	</update>
+
+	<!-- 保存用户皮肤 -->
+	<update id="saveSkin" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set
+		SKIN = #{SKIN}
+		where USERNAME = #{USERNAME}
+	</update>
+
+	<!-- 删除用户 -->
+	<delete id="deleteUser" parameterType="pd">
+		delete from
+		<include refid="tableName"></include>
+		where
+		USER_ID = #{USER_ID}
+		and
+		USER_ID != '1'
+	</delete>
+
+	<!-- 批量删除用户 -->
+	<delete id="deleteAllUser" parameterType="String">
+		delete from
+		<include refid="tableName"></include>
+		where
+		USER_ID in
+		<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
+			#{item}
+		</foreach>
+		and
+		USER_ID != '1'
+	</delete>
+
+	<!-- 用户列表(弹窗选择用) -->
+	<select id="userBystafflistPage" parameterType="page" resultType="pd">
+		select u.USER_ID,
+		u.USERNAME,
+		u.PASSWORD,
+		u.LAST_LOGIN,
+		u.NAME,
+		u.IP,
+		u.EMAIL,
+		u.NUMBER,
+		u.PHONE,
+		r.ROLE_ID,
+		r.ROLE_NAME
+		from <include refid="tableName"></include> u, <include refid="roleTableName"></include> r
+		where u.ROLE_ID = r.ROLE_ID
+		and u.USERNAME != 'admin'
+		and r.PARENT_ID = '1'
+		<if test="pd.KEYWORDS!= null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
+			and
+			(
+			u.USERNAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			or
+			u.EMAIL LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			or
+			u.NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			or
+			u.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			or
+			u.PHONE LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
+			)
+		</if>
+		<if test="pd.ROLE_ID != null and pd.ROLE_ID != ''"><!-- 角色检索 -->
+			and u.ROLE_ID=#{pd.ROLE_ID}
+		</if>
+		<if test="pd.STRARTTIME!=null and pd.STRARTTIME!=''">    <!-- 登录时间检索 -->
+			and u.LAST_LOGIN &gt;= #{pd.STRARTTIME}
+		</if>
+		<if test="pd.ENDTIME!=null and pd.ENDTIME!=''">            <!-- 登录时间检索 -->
+			and u.LAST_LOGIN &lt;= #{pd.ENDTIME}
+		</if>
+		order by u.LAST_LOGIN desc
+	</select>
+
+	<!--设置小程序菜单 -->
+	<update id="editUserFuns" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set FUN_IDS = #{FUN_IDS}
+		where
+		USER_ID = #{USER_ID}
+	</update>
+	<!-- 用户列表(全部) -->
+	<select id="listUserAndDept" parameterType="pd" resultType="pd">
+		select u.USER_ID,
+		u.USERNAME,
+		u.PASSWORD,
+		u.LAST_LOGIN,
+		u.NAME,
+		u.IP,
+		u.EMAIL,
+		u.NUMBER,
+		u.PHONE,
+		d.NAME as deptName
+		from <include refid="tableName"></include> u
+		left join oa_department d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
+		where 1=1
+		and u.DEPARTMENT_ID is not null and u.DEPARTMENT_ID !='0'
+		<if test="userIds != null">
+			and u.USER_ID in
+			<foreach item="item" index="index" collection="userIds" open="(" separator="," close=")">
+				#{item}
+			</foreach>
+		</if>
+		<if test="corpinfoId != null and corpinfoId != ''"><!--  -->
+			AND u.CORPINFO_ID = #{corpinfoId}
+		</if>
+
+		<if test="userName!= null and userName != ''"><!-- 关键词检索 -->
+			and
+			(
+			u.USERNAME LIKE CONCAT(CONCAT('%', #{userName}),'%')
+			or
+			u.NUMBER LIKE CONCAT(CONCAT('%', #{userName}),'%')
+			or
+			u.NAME LIKE CONCAT(CONCAT('%', #{userName}),'%')
+			or
+			u.PHONE LIKE CONCAT(CONCAT('%', #{userName}),'%')
+			)
+		</if>
+		<if test="deptId != null and deptId != ''"><!--  -->
+			AND u.DEPARTMENT_ID = #{deptId}
+		</if>
+		order by u.LAST_LOGIN desc
+	</select>
+	<!-- 保存用户皮肤 -->
+	<update id="updateUserStatus" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set
+		STATUS = #{STATUS}
+		where USER_ID = #{USER_ID}
+	</update>
+
+	<!-- 解锁用户 -->
+	<update id="unLockUser" parameterType="pd">
+		update
+		<include refid="tableName"></include>
+		set
+		STATUS = #{STATUS},
+		ERROR_COUNT = #{ERROR_COUNT}
+		where USER_ID = #{USER_ID}
+	</update>
+</mapper>
-- 
2.42.0.windows.1


From e8653b1870d0b6a3b9c981ee4222d0b0a3258c0d Mon Sep 17 00:00:00 2001
From: dearlin <1261008090@qq.com>
Date: Tue, 28 Nov 2023 15:26:20 +0800
Subject: [PATCH 2/2] =?UTF-8?q?add:=20=E5=88=86=E5=85=AC=E5=8F=B8=E7=B3=BB?=
 =?UTF-8?q?=E7=BB=9F=E7=AE=A1=E7=90=86=EF=BC=88=E8=8F=9C=E5=8D=95=E8=A7=92?=
 =?UTF-8?q?=E8=89=B2=E6=9D=83=E9=99=90=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/main/java/com/zcloud/controller/bus/CorpInfoController.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main/java/com/zcloud/controller/bus/CorpInfoController.java b/src/main/java/com/zcloud/controller/bus/CorpInfoController.java
index 9c96a3ea..5b4cacd9 100644
--- a/src/main/java/com/zcloud/controller/bus/CorpInfoController.java
+++ b/src/main/java/com/zcloud/controller/bus/CorpInfoController.java
@@ -236,6 +236,7 @@ public class CorpInfoController extends BaseController {
 	 * @throws Exception
 	 */
 	@RequestMapping(value="/goEdit")
+	@RequiresPermissions("corpinfo_edit_self:list")
 	@ResponseBody
 	public Object goEdit() throws Exception{
 		Map<String,Object> map = new HashMap<String,Object>();
-- 
2.42.0.windows.1