| | |
| | | return insSampleUserMapper.insert(insSampleUser); |
| | | } |
| | | |
| | | /** |
| | | * 查询模板内容 |
| | | * @param order |
| | | * @param insProducts |
| | | */ |
| | | private void getTemplateThing(InsOrder order, List<InsProduct> insProducts) { |
| | | Set<Integer> set = new HashSet<>(); |
| | | // 检验项分类+检验项+检验子项的拼接 |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.common.core.domain.TreeSelect; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | // 添加只看我 |
| | | menuService.addIsRersonal(menus, roleId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | |
| | | /** 是否可以选择仅看我, 0:否, 1:是 */ |
| | | private Integer isRersonalButton; |
| | | |
| | | /** 是否确认只看我, 0:否, 1:是 */ |
| | | private Integer isRersonal; |
| | | |
| | | /** 节点禁用 */ |
| | | private boolean disabled = false; |
| | | |
| | |
| | | this.id = menu.getMenuId(); |
| | | this.label = menu.getMenuName(); |
| | | this.isRersonalButton = menu.getIsRersonalButton(); |
| | | this.isRersonal = menu.getIsRersonal(); |
| | | this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | } |
| | | |
| | |
| | | this.children = children; |
| | | } |
| | | |
| | | public Integer geIsRersonalButton() |
| | | public Integer getIsRersonalButton() |
| | | { |
| | | return isRersonalButton; |
| | | } |
| | |
| | | { |
| | | this.isRersonalButton = isRersonalButton; |
| | | } |
| | | |
| | | public Integer getIsRersonal() |
| | | { |
| | | return isRersonal; |
| | | } |
| | | |
| | | public void setIsRersonal(Integer isRersonalButton) |
| | | { |
| | | this.isRersonal = isRersonal; |
| | | } |
| | | } |
| | |
| | | /** 是否可以选择仅看我, 0:否, 1:是 */ |
| | | private Integer isRersonalButton; |
| | | |
| | | |
| | | /** 仅看我, 0:否, 1:是 */ |
| | | private Integer isRersonal; |
| | | |
| | | /** 子菜单 */ |
| | | private List<SysMenu> children = new ArrayList<SysMenu>(); |
| | | |
| | |
| | | this.isRersonalButton = isRersonalButton; |
| | | } |
| | | |
| | | public Integer getIsRersonal() |
| | | { |
| | | return isRersonal; |
| | | } |
| | | |
| | | public void setIsRersonal(Integer isRersonal) |
| | | { |
| | | this.isRersonal = isRersonal; |
| | | } |
| | | |
| | | public List<SysMenu> getChildren() |
| | | { |
| | | return children; |
| | |
| | | /** 菜单组 */ |
| | | private Long[] menuIds; |
| | | |
| | | /** 只看我菜单组 */ |
| | | private Long[] isRersonalMenuIds; |
| | | |
| | | /** 部门组(数据权限) */ |
| | | private Long[] deptIds; |
| | | |
| | |
| | | this.menuIds = menuIds; |
| | | } |
| | | |
| | | |
| | | public Long[] getIsRersonalMenuIds() |
| | | { |
| | | return isRersonalMenuIds; |
| | | } |
| | | |
| | | public void setIsRersonalMenuIds(Long[] isRersonalMenuIds) |
| | | { |
| | | this.isRersonalMenuIds = isRersonalMenuIds; |
| | | } |
| | | |
| | | public Long[] getDeptIds() |
| | | { |
| | | return deptIds; |
| | |
| | | /** 菜单ID */ |
| | | private Long menuId; |
| | | |
| | | /** 是否只看我0否, 1是 */ |
| | | private Integer isRersonal; |
| | | |
| | | public Long getRoleId() |
| | | { |
| | | return roleId; |
| | |
| | | this.menuId = menuId; |
| | | } |
| | | |
| | | public Integer getIsRersonal() |
| | | { |
| | | return isRersonal; |
| | | } |
| | | |
| | | public void setIsRersonal(Integer isRersonal) |
| | | { |
| | | this.isRersonal = isRersonal; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | * @return |
| | | */ |
| | | SysRoleVo selectRoleMenu(@Param("permsName") String permsName, @Param("userId") Long userId); |
| | | |
| | | /** |
| | | * 查询只看我菜单id |
| | | * @param roleId |
| | | * @return |
| | | */ |
| | | List<Long> selectIsRersonalMenu(@Param("roleId") Long roleId); |
| | | } |
| | |
| | | * @return 结果 |
| | | */ |
| | | public boolean checkMenuNameUnique(SysMenu menu); |
| | | |
| | | /** |
| | | * 添加只看我 |
| | | * @param menus |
| | | * @param roleId |
| | | */ |
| | | void addIsRersonal(List<SysMenu> menus, Long roleId); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 添加只看我 |
| | | * @param menus |
| | | * @param roleId |
| | | */ |
| | | @Override |
| | | public void addIsRersonal(List<SysMenu> menus, Long roleId) { |
| | | // 查询只看我菜单id |
| | | List<Long> menuIds = roleMenuMapper.selectIsRersonalMenu(roleId); |
| | | for (SysMenu menu : menus) { |
| | | if (menuIds.contains(menu.getMenuId())) { |
| | | menu.setIsRersonal(1); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获取路由名称 |
| | | * |
| | | * @param menu 菜单信息 |
| | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | SysRoleMenu rm = new SysRoleMenu(); |
| | | rm.setRoleId(role.getRoleId()); |
| | | rm.setMenuId(menuId); |
| | | // 判断是否有只看我权限 |
| | | if (ArrayUtils.isNotEmpty(role.getIsRersonalMenuIds())) { |
| | | for (Long isRersonalMenuId : role.getIsRersonalMenuIds()) { |
| | | if (isRersonalMenuId.equals(menuId)) { |
| | | rm.setIsRersonal(1); |
| | | } |
| | | } |
| | | } |
| | | list.add(rm); |
| | | |
| | | } |
| | | if (list.size() > 0) |
| | | { |
| | |
| | | group by sm.menu_id |
| | | </select> |
| | | |
| | | <!-- 查询只看我菜单id --> |
| | | <select id="selectIsRersonalMenu" resultType="java.lang.Long"> |
| | | select menu_id |
| | | from sys_role_menu |
| | | where role_id = #{roleId} |
| | | and is_rersonal = 1 |
| | | </select> |
| | | |
| | | <delete id="deleteRoleMenuByRoleId" parameterType="Long"> |
| | | delete from sys_role_menu where role_id=#{roleId} |
| | | </delete> |
| | |
| | | </delete> |
| | | |
| | | <insert id="batchRoleMenu"> |
| | | insert into sys_role_menu(role_id, menu_id) values |
| | | insert into sys_role_menu(role_id, menu_id, is_rersonal) values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | (#{item.roleId},#{item.menuId}) |
| | | (#{item.roleId},#{item.menuId},#{item.isRersonal}) |
| | | </foreach> |
| | | </insert> |
| | | |