Merge branch 'master' of http://121.40.234.130:8899/root/nl-sso-server
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package org.nl.common.domain.constant;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/26 9:29 上午
|
||||
*/
|
||||
public class DictConstantPool {
|
||||
|
||||
public static final String DICT_SYS_CODE = "system_type";
|
||||
public static final String DICT_SYS_NAME = "所属系统";
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package org.nl.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.query.LConsumer;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -19,7 +20,8 @@ public enum QueryTEnum {
|
||||
LE((q, k, v) -> { q.le(k[0],v); }),
|
||||
BY((q, k, v) -> { q.orderByDesc(k[0],v); }),
|
||||
NO((q, k, v) -> { q.isNull(k[0]); }),
|
||||
LT((q, k, v) -> { q.lt(k[0],v); });
|
||||
LT((q, k, v) -> { q.lt(k[0],v); }),
|
||||
OREQ((q, k, v) -> { if (StringUtils.isBlank((String)v)){ q.isNull(k[0]); }else { q.eq(k[0],v); } });
|
||||
|
||||
private LConsumer<QueryWrapper,String[], Object> doP;
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.nl.modules.common.base.BaseDTO;
|
||||
import org.nl.modules.system.service.dto.MenuDto;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@@ -26,7 +26,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.system.service.MenuService;
|
||||
import org.nl.modules.system.service.dto.MenuDto;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -43,7 +43,7 @@ import java.util.*;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统:菜单管理")
|
||||
@RequestMapping("/api/menus")
|
||||
@RequestMapping("/api/menus2")
|
||||
public class MenuController {
|
||||
|
||||
private final MenuService menuService;
|
||||
|
||||
@@ -17,9 +17,7 @@ package org.nl.modules.system.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.system.domain.Menu;
|
||||
import org.nl.modules.system.service.dto.MenuDto;
|
||||
import org.nl.modules.system.service.dto.MenuQueryCriteria;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.nl.modules.system.service.dto;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.nl.modules.common.base.BaseDTO;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -11,11 +11,11 @@ import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.domain.vo.MenuMetaVo;
|
||||
import org.nl.modules.system.domain.vo.MenuVo;
|
||||
import org.nl.modules.system.service.MenuService;
|
||||
import org.nl.modules.system.service.dto.MenuDto;
|
||||
import org.nl.modules.tools.IdUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -69,7 +69,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
public MenuDto menuJsonToMenuDto(JSONObject json) {
|
||||
MenuDto menuDto = new MenuDto();
|
||||
menuDto.setMenuId(json.getString("menu_id"));
|
||||
menuDto.setType(json.getInteger("type"));
|
||||
menuDto.setType(json.getString("type"));
|
||||
menuDto.setPermission(json.getString("permission"));
|
||||
menuDto.setTitle(json.getString("title"));
|
||||
menuDto.setMenuSort(json.getInteger("menu_sort"));
|
||||
@@ -79,7 +79,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
menuDto.setIcon(json.getString("icon"));
|
||||
|
||||
menuDto.setSubCount(json.getInteger("sub_count"));
|
||||
menuDto.setIFrame("1".equals(json.getString("i_frame")));
|
||||
menuDto.setIframe("1".equals(json.getString("i_frame")));
|
||||
menuDto.setCache("1".equals(json.getString("cache")));
|
||||
menuDto.setHidden("1".equals(json.getString("hidden")));
|
||||
menuDto.setComponentName(json.getString("component_name"));
|
||||
@@ -197,7 +197,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
}
|
||||
|
||||
if (newMenu.getIFrame()) {
|
||||
if (newMenu.getIframe()) {
|
||||
String http = "http://", https = "https://";
|
||||
if (!(newMenu.getPath().toLowerCase().startsWith(http) || newMenu.getPath().toLowerCase().startsWith(https))) {
|
||||
throw new BadRequestException("外链必须以http://或者https://开头");
|
||||
@@ -326,10 +326,10 @@ public class MenuServiceImpl implements MenuService {
|
||||
menuVo.setPath(ObjectUtil.isEmpty(menuDTO.getPid()) ? "/" + menuDTO.getPath() : menuDTO.getPath());
|
||||
menuVo.setHidden(menuDTO.getHidden());
|
||||
// 如果不是外链
|
||||
if (!menuDTO.getIFrame()) {
|
||||
if (!menuDTO.getIframe()) {
|
||||
if (ObjectUtil.isEmpty(menuDTO.getPid())) {
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent());
|
||||
} else if (!ObjectUtil.isEmpty(menuDTO.getPid()) && menuDTO.getType() == 0) {
|
||||
} else if (!ObjectUtil.isEmpty(menuDTO.getPid()) && "0".equals(menuDTO.getType())) {
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent());
|
||||
|
||||
} else if (!StrUtil.isEmpty(menuDTO.getComponent())) {
|
||||
@@ -346,7 +346,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
MenuVo menuVo1 = new MenuVo();
|
||||
menuVo1.setMeta(menuVo.getMeta());
|
||||
// 非外链
|
||||
if (!menuDTO.getIFrame()) {
|
||||
if (!menuDTO.getIframe()) {
|
||||
menuVo1.setPath("index");
|
||||
menuVo1.setName(menuVo.getName());
|
||||
menuVo1.setComponent(menuVo.getComponent());
|
||||
|
||||
@@ -3,16 +3,18 @@ package org.nl.system.controller.menu;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.system.service.dto.MenuDto;
|
||||
import org.nl.system.service.menu.ISysMenuService;
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
import org.nl.system.service.menu.dto.MenuQuery;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -33,45 +35,29 @@ import java.util.stream.Collectors;
|
||||
@RequestMapping("api/sysMenu")
|
||||
@RequiredArgsConstructor
|
||||
public class SysMenuController {
|
||||
private final ISysMenuService baseService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询菜单")
|
||||
@SaCheckPermission("menu:list")
|
||||
public ResponseEntity<Object> pageQuery(@RequestParam Map param, Pageable page) throws Exception {
|
||||
TableDataInfo data = TableDataInfo.build(baseService.queryAll(param));
|
||||
return new ResponseEntity<>(data, HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("返回全部的菜单")
|
||||
@GetMapping(value = "/lazy")//新增时候点击
|
||||
@SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> query(@RequestParam String pid) {
|
||||
return new ResponseEntity<>(baseService.getMenus(pid), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
||||
@PostMapping("/superior")
|
||||
@SaCheckPermission("menu:list")
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody List<String> ids) {
|
||||
Set<MenuDto> menuDtos = new LinkedHashSet<>();
|
||||
if (CollectionUtil.isNotEmpty(ids)) {
|
||||
for (String id : ids) {
|
||||
MenuDto menuDto = baseService.doToDto(baseService.findById(id));
|
||||
menuDtos.addAll(baseService.getSuperior(menuDto, new ArrayList<>()));
|
||||
}
|
||||
return new ResponseEntity<>(baseService.buildTree(new ArrayList<>(menuDtos)), HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(baseService.getMenus(null), HttpStatus.OK);
|
||||
}
|
||||
private final ISysMenuService iSysMenuService;
|
||||
|
||||
@GetMapping(value = "/build")
|
||||
@ApiOperation("根据用户获取菜单")
|
||||
public ResponseEntity<Object> buildMenus() {
|
||||
List<MenuDto> menuDtoList = baseService.findByUser(SecurityUtils.getCurrentUserId());
|
||||
List<MenuDto> menuDtos = baseService.buildTree(menuDtoList);
|
||||
return new ResponseEntity<>(baseService.buildMenus(menuDtos), HttpStatus.OK);
|
||||
public ResponseEntity<Object> buildMenus(@Validated String systemType) {
|
||||
//校验系统表是否存在该系统类型
|
||||
return new ResponseEntity(iSysMenuService.buildMenus(systemType),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("返回全部的菜单")
|
||||
@GetMapping(value = "/lazy")
|
||||
@SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> query(@RequestParam String pid) {
|
||||
return new ResponseEntity<>(iSysMenuService.getMenus(pid), HttpStatus.OK);
|
||||
}
|
||||
@ApiOperation("获取菜单列表")
|
||||
@PostMapping(value = "/getMenusByRole")
|
||||
@SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> getMenusByRole(@RequestBody JSONObject json) {
|
||||
String role_id = json.getString("role_id");
|
||||
String system_type = json.getString("system_type");
|
||||
String category = json.getString("category");
|
||||
return new ResponseEntity<>(iSysMenuService.getMenusByRole(role_id, system_type, category), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("根据菜单ID返回所有子节点ID,包含自身ID")
|
||||
@@ -79,19 +65,40 @@ public class SysMenuController {
|
||||
@SaCheckPermission(value = {"menu:list", "roles:list"}, mode = SaMode.AND)
|
||||
public ResponseEntity<Object> child(@RequestParam String id) {
|
||||
Set<SysMenu> menuSet = new HashSet<>();
|
||||
List<SysMenu> menuList = baseService.getMenus(id);
|
||||
menuSet.add(baseService.findById(id));
|
||||
menuSet = baseService.getChildMenus(menuList, menuSet);
|
||||
List<SysMenu> menuList = iSysMenuService.getMenus(id);
|
||||
menuSet.add(iSysMenuService.findById(id));
|
||||
menuSet = iSysMenuService.getChildMenus(menuList, menuSet);
|
||||
Set<String> ids = menuSet.stream().map(SysMenu::getMenuId).collect(Collectors.toSet());
|
||||
return new ResponseEntity<>(ids, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询菜单")
|
||||
@SaCheckPermission("menu:list")
|
||||
public ResponseEntity<Object> pageQuery(MenuQuery query, PageQuery page) throws Exception {
|
||||
List list = iSysMenuService.query(query, page);
|
||||
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
||||
@PostMapping("/superior")
|
||||
@SaCheckPermission("menu:list")
|
||||
public ResponseEntity<Object> getSuperior(@RequestBody JSONObject param) {
|
||||
Set<MenuDto> menuDtos = new LinkedHashSet<>();
|
||||
String id=param.getString("ids");
|
||||
if (StrUtil.isNotEmpty(id)) {
|
||||
menuDtos.addAll(iSysMenuService.getSuperior(iSysMenuService.doToDto(iSysMenuService.findById(id)), new ArrayList<>()));
|
||||
return new ResponseEntity<>(iSysMenuService.buildTree(new ArrayList<>(menuDtos)), HttpStatus.OK);
|
||||
}
|
||||
return new ResponseEntity<>(iSysMenuService.getMenus(null), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增菜单")
|
||||
@ApiOperation("新增菜单")
|
||||
@PostMapping
|
||||
@SaCheckPermission("menu:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SysMenu resources) {
|
||||
baseService.create(resources);
|
||||
public ResponseEntity<Object> create(@RequestBody SysMenu form) {
|
||||
iSysMenuService.create(form);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -99,8 +106,8 @@ public class SysMenuController {
|
||||
@ApiOperation("修改菜单")
|
||||
@PutMapping
|
||||
@SaCheckPermission("menu:edit")
|
||||
public ResponseEntity<Object> update(@RequestBody SysMenu resources) {
|
||||
baseService.update(resources);
|
||||
public ResponseEntity<Object> update( @RequestBody SysMenu form) {
|
||||
iSysMenuService.update(form);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -111,12 +118,11 @@ public class SysMenuController {
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
Set<SysMenu> menuSet = new HashSet<>();
|
||||
for (String id : ids) {
|
||||
//获取所有子节点
|
||||
List<SysMenu> menuList = baseService.getMenus(id);
|
||||
menuSet.add(baseService.findById(id));
|
||||
menuSet = baseService.getChildMenus(menuList, menuSet);
|
||||
List<SysMenu> menuList = iSysMenuService.getMenus(id);
|
||||
menuSet.add(iSysMenuService.findById(id));
|
||||
menuSet = iSysMenuService.getChildMenus(menuList, menuSet);
|
||||
}
|
||||
baseService.delete(menuSet);
|
||||
iSysMenuService.delete(menuSet);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package org.nl.system.service.menu;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.system.domain.vo.MenuVo;
|
||||
import org.nl.modules.system.service.dto.MenuDto;
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
import org.nl.system.service.menu.dto.MenuQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -26,6 +28,14 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||
*/
|
||||
List<MenuDto> queryAll(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
* @param query
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
List query(MenuQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 根据ID获取同级与上级数据
|
||||
*
|
||||
@@ -98,6 +108,9 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||
* @return /
|
||||
*/
|
||||
List<MenuVo> buildMenus(List<MenuDto> menuDtos);
|
||||
List<MenuVo> buildMenus(List<MenuDto> menuDtos,String pid);
|
||||
|
||||
List<MenuVo> buildMenus(String systemType);
|
||||
|
||||
/**
|
||||
* 构建菜单树
|
||||
@@ -121,4 +134,6 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||
*/
|
||||
MenuDto doToDto(SysMenu sysMenu);
|
||||
|
||||
List<Map> getMenusByRole(String roleId, String systemType, String category);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package org.nl.system.service.menu.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -32,6 +31,7 @@ public class SysMenu implements Serializable {
|
||||
/**
|
||||
* 上级菜单ID
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public class SysMenu implements Serializable {
|
||||
/**
|
||||
* 是否外链
|
||||
*/
|
||||
private Boolean iFrame;
|
||||
private Boolean iframe;
|
||||
|
||||
/**
|
||||
* 是否缓存
|
||||
@@ -117,7 +117,7 @@ public class SysMenu implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改人标识
|
||||
@@ -132,7 +132,7 @@ public class SysMenu implements Serializable {
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Select;
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -31,6 +32,14 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
*/
|
||||
List<SysMenu> findByUser(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* 获取系统菜单
|
||||
* @param userId
|
||||
* @param systemType
|
||||
* @return
|
||||
*/
|
||||
List<SysMenu> findSystemMenu(@Param("user") String userId,@Param("systemType") String systemType);
|
||||
|
||||
/**
|
||||
* 根据用户标识获取权限列表
|
||||
*
|
||||
@@ -46,4 +55,8 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
*/
|
||||
@Delete(value = "delete from sys_roles_menus where menu_id = #{menuId}")
|
||||
void untiedMenu(String menuId);
|
||||
|
||||
List<Map> getMenusByRole(@Param("systemType") String systemType, @Param("category")String category);
|
||||
|
||||
String findAllChild(String pid);
|
||||
}
|
||||
|
||||
@@ -51,4 +51,51 @@
|
||||
AND permission IS NOT NULL
|
||||
AND permission != ''
|
||||
</select>
|
||||
<select id="findSystemMenu" resultType="org.nl.system.service.menu.dao.SysMenu">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sys_menu
|
||||
WHERE
|
||||
type != '2'
|
||||
and system_type = #{systemType}
|
||||
and
|
||||
menu_id IN (
|
||||
SELECT
|
||||
menu_id
|
||||
FROM
|
||||
sys_roles_menus
|
||||
WHERE
|
||||
role_id IN ( SELECT role_id FROM sys_users_roles where user_id = #{user})
|
||||
)
|
||||
</select>
|
||||
<select id="getMenusByRole" resultType="java.util.Map">
|
||||
SELECT
|
||||
m.* ,
|
||||
(CASE WHEN rm.menu_id IS NULL THEN '0' ELSE '1' END ) AS is_checked ,
|
||||
(CASE WHEN 0 >= sub_count THEN true ELSE false END ) AS leaf
|
||||
FROM
|
||||
sys_menu m
|
||||
LEFT JOIN sys_roles_menus rm ON m.menu_id = rm.menu_id
|
||||
where (pid is null or pid=0)
|
||||
<if test="systemType != null">
|
||||
and system_type = #{systemType}
|
||||
</if>
|
||||
<if test="category != null">
|
||||
and category = #{category}
|
||||
</if>
|
||||
</select>
|
||||
<select id="findAllChild" resultType="java.lang.String">
|
||||
SELECT
|
||||
max(t3.childId) as menus
|
||||
from
|
||||
(
|
||||
select *,
|
||||
if( find_in_set(t1.pid, @p) > 0,@p := concat(@p,',',id),0 ) as childId
|
||||
from
|
||||
(select menu_id as id, pid from sys_menu t order by id) t1,
|
||||
(select @p := #{pid}) t2
|
||||
) t3
|
||||
where childId != '0'
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -13,29 +13,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.modules.system.service.dto;
|
||||
package org.nl.system.service.menu.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.Data;
|
||||
import org.nl.modules.common.base.BaseDTO;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-17
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Data
|
||||
public class MenuDto extends BaseDTO implements Serializable {
|
||||
|
||||
private String menuId;
|
||||
|
||||
private List<MenuDto> children;
|
||||
|
||||
private Integer type;
|
||||
private String type;
|
||||
|
||||
private String permission;
|
||||
|
||||
@@ -52,8 +46,9 @@ public class MenuDto extends BaseDTO implements Serializable {
|
||||
|
||||
private Integer subCount;
|
||||
|
||||
private Boolean iFrame;
|
||||
private Boolean iframe;
|
||||
|
||||
private String systemType;
|
||||
|
||||
private Boolean cache;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.system.service.menu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.common.domain.query.QParam;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2022/12/15
|
||||
*/
|
||||
@Data
|
||||
public class MenuQuery extends BaseQuery<SysMenu> {
|
||||
private String pid = "";
|
||||
private String systemType;
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
this.doP.put("pid", QParam.builder().k(new String[]{"pid"}).type(QueryTEnum.OREQ).build());
|
||||
this.doP.put("blurry", QParam.builder().k(new String[]{"title"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
}
|
||||
@@ -4,19 +4,31 @@ import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.constant.DictConstantPool;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.domain.vo.MenuMetaVo;
|
||||
import org.nl.modules.system.domain.vo.MenuVo;
|
||||
import org.nl.modules.system.service.dto.MenuDto;
|
||||
import org.nl.modules.system.util.CopyUtil;
|
||||
import org.nl.modules.tools.IdUtil;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.dict.dao.mapper.SysDictMapper;
|
||||
import org.nl.system.service.menu.dto.MenuDto;
|
||||
import org.nl.system.service.menu.ISysMenuService;
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
import org.nl.system.service.menu.dao.mapper.SysMenuMapper;
|
||||
import org.nl.system.service.menu.dto.MenuQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -33,7 +45,9 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {
|
||||
|
||||
private final SysMenuMapper baseMapper;
|
||||
private final SysDictMapper sysDictMapper;
|
||||
|
||||
@Override
|
||||
public List<MenuDto> queryAll(Map<String, Object> param) {
|
||||
@@ -42,6 +56,17 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
return getMenus(pid).stream().map(menu -> this.doToDto(menu)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List query(MenuQuery query, PageQuery page) {
|
||||
if (StringUtils.isNotEmpty(query.getBlurry())){
|
||||
query.setPid(null);
|
||||
}
|
||||
Page<SysMenu> menuPage = this.page(page.build(), query.build());
|
||||
List<MenuDto> collect = menuPage.getRecords().stream().map(menu -> this.doToDto(menu)).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuDto> getSuperior(MenuDto menuDto, List<SysMenu> menus) {
|
||||
if (menuDto.getPid() == null) {
|
||||
@@ -84,59 +109,111 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
@Override
|
||||
public void create(SysMenu resources) {
|
||||
|
||||
if (resources.getPid().equals("0")) {
|
||||
resources.setPid(null);
|
||||
}
|
||||
if (resources.getIFrame()) {
|
||||
if (resources.getIframe()) {
|
||||
String http = "http://", https = "https://";
|
||||
if (!(resources.getPath().toLowerCase().startsWith(http) || resources.getPath().toLowerCase().startsWith(https))) {
|
||||
throw new BadRequestException("外链必须以http://或者https://开头");
|
||||
}
|
||||
}
|
||||
resources.setMenuId(IdUtil.getStringId());
|
||||
if (resources.getPid().equals("0")) {
|
||||
resources.setPid(null);
|
||||
addSystemTypeDict(resources);
|
||||
}
|
||||
|
||||
baseMapper.insert(resources);
|
||||
// 计算子节点数目
|
||||
resources.setSubCount(0);
|
||||
// 更新父节点菜单数目
|
||||
updateSubCnt(resources.getPid());
|
||||
updateRootSystemType(resources);
|
||||
}
|
||||
|
||||
private void addSystemTypeDict(SysMenu resources) {
|
||||
Dict dict = sysDictMapper.selectOne(new QueryWrapper<Dict>().eq("code", DictConstantPool.DICT_SYS_CODE).orderByDesc("value").last("limit 1"));
|
||||
Integer currentType = dict!=null?Integer.valueOf(dict.getValue())+1:1;
|
||||
Dict currentSysType = new Dict();
|
||||
currentSysType.setDictId(IdUtil.getStringId());
|
||||
currentSysType.setCode(DictConstantPool.DICT_SYS_CODE);
|
||||
currentSysType.setName(DictConstantPool.DICT_SYS_NAME);
|
||||
currentSysType.setLabel(resources.getTitle());
|
||||
currentSysType.setValue(String.valueOf(currentType));
|
||||
currentSysType.setPara1(resources.getMenuId());
|
||||
sysDictMapper.insert(currentSysType);
|
||||
resources.setSystemType(String.valueOf(currentType));
|
||||
}
|
||||
private void updateRootSystemType(SysMenu sysMenu) {
|
||||
String rootMenuId = this.findRootMenuId(sysMenu.getMenuId());
|
||||
if (sysMenu.getMenuId().equals(rootMenuId)){
|
||||
return;
|
||||
}
|
||||
SysMenu rootMenu = this.findById(rootMenuId);
|
||||
sysMenu.setSystemType(rootMenu.getSystemType());
|
||||
this.updateById(sysMenu);
|
||||
}
|
||||
private String findRootMenuId(String menuId) {
|
||||
SysMenu sysMenu = this.findById(menuId);
|
||||
if (StrUtil.isEmpty(sysMenu.getPid())) {
|
||||
return menuId;
|
||||
} else {
|
||||
return findRootMenuId(sysMenu.getPid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Set<SysMenu> menuSet) {
|
||||
List<String> pids = Lists.newArrayList();
|
||||
for (SysMenu menu : menuSet) {
|
||||
//解绑菜单
|
||||
baseMapper.untiedMenu(menu.getMenuId());
|
||||
baseMapper.deleteById(menu.getMenuId());
|
||||
updateSubCnt(menu.getPid());
|
||||
String pid = menu.getPid();
|
||||
if (StringUtils.isEmpty(pid)){
|
||||
pids.add(pid);
|
||||
}
|
||||
updateSubCnt(pid);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(pids)){
|
||||
sysDictMapper.delete(new QueryWrapper<Dict>().in("para1", pids).eq("code", DictConstantPool.DICT_SYS_CODE));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void update(SysMenu resources) {
|
||||
if (resources.getMenuId().equals(resources.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
String menuId = resources.getMenuId();
|
||||
SysMenu menu = baseMapper.selectById(menuId);
|
||||
List<String> allChildIds = Arrays.asList(baseMapper.findAllChild(menuId).split(","));
|
||||
if (allChildIds.contains(resources.getPid())){
|
||||
throw new BadRequestException("上级不能为自己或自己的下级");
|
||||
}
|
||||
SysMenu menu = baseMapper.selectById(resources.getMenuId());
|
||||
if (resources.getIFrame()) {
|
||||
if (resources.getIframe()) {
|
||||
String http = "http://", https = "https://";
|
||||
if (!(resources.getPath().toLowerCase().startsWith(http) || resources.getPath().toLowerCase().startsWith(https))) {
|
||||
throw new BadRequestException("外链必须以http://或者https://开头");
|
||||
}
|
||||
}
|
||||
|
||||
if (resources.getPid().equals("0")) {
|
||||
resources.setPid(null);
|
||||
if (StringUtils.isNotEmpty(menu.getPid())){
|
||||
addSystemTypeDict(resources);
|
||||
}
|
||||
}else {
|
||||
resources.setSystemType(this.findById(resources.getPid()).getSystemType());
|
||||
}
|
||||
|
||||
// 记录的父节点ID
|
||||
String oldPid = menu.getPid();
|
||||
String newPid = resources.getPid();
|
||||
// 记录的父节点ID
|
||||
if (oldPid == null && newPid != null){
|
||||
sysDictMapper.delete(new QueryWrapper<Dict>().eq("para1",menu.getMenuId()));
|
||||
}
|
||||
menu.setTitle(resources.getTitle());
|
||||
menu.setComponent(resources.getComponent());
|
||||
menu.setPath(resources.getPath());
|
||||
menu.setIcon(resources.getIcon());
|
||||
menu.setIFrame(resources.getIFrame());
|
||||
menu.setIframe(resources.getIframe());
|
||||
menu.setPid(resources.getPid());
|
||||
menu.setMenuSort(resources.getMenuSort());
|
||||
menu.setCache(resources.getCache());
|
||||
@@ -148,6 +225,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
// 计算父级菜单节点数目
|
||||
updateSubCnt(oldPid);
|
||||
updateSubCnt(newPid);
|
||||
//更新SystemType
|
||||
if (!resources.getSystemType().equals(menu.getSystemType())){
|
||||
this.update(new UpdateWrapper<SysMenu>().set(DictConstantPool.DICT_SYS_CODE,resources.getSystemType()).in("menu_id",allChildIds));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,10 +264,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
menuVo.setPath(ObjectUtil.isEmpty(menuDTO.getPid()) ? "/" + menuDTO.getPath() : menuDTO.getPath());
|
||||
menuVo.setHidden(menuDTO.getHidden());
|
||||
// 如果不是外链
|
||||
if (!menuDTO.getIFrame()) {
|
||||
if (!menuDTO.getIframe()) {
|
||||
if (ObjectUtil.isEmpty(menuDTO.getPid())) {
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent());
|
||||
} else if (!ObjectUtil.isEmpty(menuDTO.getPid()) && menuDTO.getType() == 0) {
|
||||
} else if (!ObjectUtil.isEmpty(menuDTO.getPid()) && "0".equals(menuDTO.getType())) {
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent());
|
||||
|
||||
} else if (!StrUtil.isEmpty(menuDTO.getComponent())) {
|
||||
@@ -202,7 +284,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
MenuVo menuVo1 = new MenuVo();
|
||||
menuVo1.setMeta(menuVo.getMeta());
|
||||
// 非外链
|
||||
if (!menuDTO.getIFrame()) {
|
||||
if (!menuDTO.getIframe()) {
|
||||
menuVo1.setPath("index");
|
||||
menuVo1.setName(menuVo.getName());
|
||||
menuVo1.setComponent(menuVo.getComponent());
|
||||
@@ -262,20 +344,25 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
public MenuDto doToDto(SysMenu entity) {
|
||||
|
||||
MenuDto menuDto = new MenuDto();
|
||||
if (ObjectUtil.isEmpty(entity)){
|
||||
return menuDto;
|
||||
}
|
||||
menuDto.setMenuId(entity.getMenuId());
|
||||
menuDto.setType(Integer.parseInt(entity.getType()));
|
||||
menuDto.setType(entity.getType());
|
||||
menuDto.setPermission(entity.getPermission());
|
||||
menuDto.setTitle(entity.getTitle());
|
||||
menuDto.setMenuSort(entity.getMenuSort());
|
||||
menuDto.setPath(entity.getPath());
|
||||
menuDto.setComponent(entity.getComponent());
|
||||
menuDto.setSystemType(entity.getSystemType());
|
||||
menuDto.setPid(entity.getPid());
|
||||
menuDto.setSubCount(entity.getSubCount());
|
||||
menuDto.setIFrame(entity.getIFrame());
|
||||
menuDto.setIframe(entity.getIframe());
|
||||
menuDto.setCache(entity.getCache());
|
||||
menuDto.setHidden(entity.getHidden());
|
||||
menuDto.setComponentName(entity.getComponentName());
|
||||
menuDto.setIcon(entity.getIcon());
|
||||
menuDto.setCreateTime(entity.getCreateTime());
|
||||
|
||||
//构建前端需要的数据结构树
|
||||
Integer sub_count = entity.getSubCount();
|
||||
@@ -289,4 +376,77 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
return menuDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuVo> buildMenus(String systemType) {
|
||||
Dict dict = sysDictMapper.selectOne(new QueryWrapper<Dict>().eq("code", DictConstantPool.DICT_SYS_CODE).eq("value", systemType));
|
||||
if (dict == null || StringUtils.isEmpty(dict.getPara1())){
|
||||
throw new BadRequestException("获取对应的系统菜单不存在");
|
||||
}
|
||||
String pid = dict.getPara1();
|
||||
List<SysMenu> menuDtoList = baseMapper.findSystemMenu(SecurityUtils.getCurrentUserId(),systemType);
|
||||
//移除系统级菜单
|
||||
menuDtoList.removeIf(a->a.getMenuId().equals(pid));
|
||||
List<MenuDto> menuDtos = this.buildTree(CopyUtil.copyList(menuDtoList, MenuDto.class));
|
||||
return this.buildMenus(menuDtos,pid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuVo> buildMenus(List<MenuDto> menuDtos, String pid) {
|
||||
List<MenuVo> list = new LinkedList<>();
|
||||
//剔除系统级菜单
|
||||
menuDtos.forEach(menuDTO -> {
|
||||
if (menuDTO != null) {
|
||||
List<MenuDto> menuDtoList = menuDTO.getChildren();
|
||||
MenuVo menuVo = new MenuVo();
|
||||
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponentName()) ? menuDTO.getComponentName() : menuDTO.getTitle());
|
||||
// 一级目录需要加斜杠,不然会报警告
|
||||
menuVo.setPath(pid.equals(menuDTO.getPid())? "/" + menuDTO.getPath() : menuDTO.getPath());
|
||||
menuVo.setHidden(menuDTO.getHidden());
|
||||
// 如果不是外链
|
||||
if (!menuDTO.getIframe()) {
|
||||
if (pid.equals(menuDTO.getPid())) {
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent());
|
||||
} else if (!pid.equals(menuDTO.getPid()) && "0".equals(menuDTO.getType())) {
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent());
|
||||
|
||||
} else if (!StrUtil.isEmpty(menuDTO.getComponent())) {
|
||||
menuVo.setComponent(menuDTO.getComponent());
|
||||
}
|
||||
}
|
||||
menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(), menuDTO.getIcon(), !menuDTO.getCache()));
|
||||
if (menuDtoList != null && menuDtoList.size() != 0) {
|
||||
menuVo.setAlwaysShow(true);
|
||||
menuVo.setRedirect("noredirect");
|
||||
menuVo.setChildren(buildMenus(menuDtoList,pid));
|
||||
// 处理是一级菜单并且没有子菜单的情况
|
||||
} else if (StrUtil.isEmpty(menuDTO.getPid())) {
|
||||
MenuVo menuVo1 = new MenuVo();
|
||||
menuVo1.setMeta(menuVo.getMeta());
|
||||
// 非外链
|
||||
if (!menuDTO.getIframe()) {
|
||||
menuVo1.setPath("index");
|
||||
menuVo1.setName(menuVo.getName());
|
||||
menuVo1.setComponent(menuVo.getComponent());
|
||||
} else {
|
||||
menuVo1.setPath(menuDTO.getPath());
|
||||
}
|
||||
menuVo.setName(null);
|
||||
menuVo.setMeta(null);
|
||||
menuVo.setComponent("Layout");
|
||||
List<MenuVo> list1 = new ArrayList<>();
|
||||
list1.add(menuVo1);
|
||||
menuVo.setChildren(list1);
|
||||
}
|
||||
list.add(menuVo);
|
||||
}
|
||||
}
|
||||
);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getMenusByRole(String roleId, String systemType, String category) {
|
||||
baseMapper.getMenusByRole(systemType,category);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
@@ -227,8 +227,7 @@ public class OnlineUserService {
|
||||
// 校验数据库
|
||||
// 根据用户名查询,在比对密码
|
||||
SysUser userInfo = sysUserService.getOne(new QueryWrapper<SysUser>().eq("username",authUser.getUsername()));
|
||||
String dbPassword = userInfo.getPassword();
|
||||
if (!dbPassword.equals(SaSecureUtil.md5BySalt(password, "salt"))) { // 这里需要密码加密
|
||||
if (userInfo == null||!userInfo.getPassword().equals(SaSecureUtil.md5BySalt(password, "salt"))) { // 这里需要密码加密
|
||||
throw new BadRequestException("账号或密码错误");
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@
|
||||
left join sys_dept on sys_user_dept.dept_id = sys_dept.dept_id
|
||||
<where>
|
||||
<if test="query.deptId != null">
|
||||
and sys_dept.dept_id = #{query.deptId}
|
||||
and
|
||||
sys_user.user_id in (select user_id from sys_user_dept where dept_id = #{query.deptId})
|
||||
</if>
|
||||
<if test="query.isUsed != null">
|
||||
and sys_user.is_used = #{query.isUsed}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -107,7 +108,6 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
@Transactional
|
||||
public void update(Map userDetail) {
|
||||
if(CollectionUtils.isEmpty(userDetail)|| userDetail.get("userId")==null){
|
||||
@@ -128,7 +128,11 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
||||
}
|
||||
}
|
||||
}, Date.class);
|
||||
BeanUtils.populate(sysUser,userDetail);
|
||||
try {
|
||||
BeanUtils.populate(sysUser,userDetail);
|
||||
}catch (Exception ex){
|
||||
throw new RuntimeException();
|
||||
}
|
||||
sysUser.setUpdateTime(new Date());
|
||||
sysUser.setUpdateId(SecurityUtils.getCurrentUserId());
|
||||
this.updateById(sysUser);
|
||||
@@ -136,9 +140,9 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
||||
deptService.delUserDeptRelation(sysUser.getUserId());
|
||||
deptService.saveUserDeptRelation(sysUser.getUserId(), (List) userDetail.get("deptIds"));
|
||||
};
|
||||
if (userDetail.get("roleIds") !=null){
|
||||
if (userDetail.get("rolesIds") !=null){
|
||||
roleService.delUserRoleRelation(sysUser.getUserId());
|
||||
roleService.saveUserRoleRelation(sysUser.getUserId(),(List) userDetail.get("roleIds"));
|
||||
roleService.saveUserRoleRelation(sysUser.getUserId(),(List) userDetail.get("rolesIds"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user