角色修改&&去除缓存
This commit is contained in:
@@ -7,14 +7,12 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
import org.nl.modules.logging.annotation.Log;
|
||||||
import org.nl.modules.system.domain.Role;
|
|
||||||
import org.nl.modules.system.domain.vo.RoleVo;
|
import org.nl.modules.system.domain.vo.RoleVo;
|
||||||
import org.nl.modules.system.service.RoleService;
|
import org.nl.modules.system.service.RoleService;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -22,8 +20,8 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Zheng Jie
|
* @author ludj
|
||||||
* @date 2018-12-03
|
* @date 2022-12-05
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -33,14 +31,6 @@ public class RoleController {
|
|||||||
|
|
||||||
private final RoleService roleService;
|
private final RoleService roleService;
|
||||||
|
|
||||||
private static final String ENTITY_NAME = "role";
|
|
||||||
|
|
||||||
@ApiOperation("获取单个role")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
@SaCheckPermission("roles:list")
|
|
||||||
public ResponseEntity<Object> query(@PathVariable Long id) {
|
|
||||||
return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取单个role")
|
@ApiOperation("获取单个role")
|
||||||
@GetMapping(value = "/all")
|
@GetMapping(value = "/all")
|
||||||
@@ -61,28 +51,27 @@ public class RoleController {
|
|||||||
@Log("新增角色")
|
@Log("新增角色")
|
||||||
@ApiOperation("新增角色")
|
@ApiOperation("新增角色")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@SaCheckPermission("roles:add")
|
// @SaCheckPermission("roles:add")
|
||||||
public ResponseEntity<Object> create(@Validated @RequestBody Role resources) {
|
public ResponseEntity<Object> create(@RequestBody JSONObject param) {
|
||||||
// roleService.create(resources);
|
roleService.create(param);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Log("修改角色")
|
@Log("修改角色")
|
||||||
@ApiOperation("修改角色")
|
@ApiOperation("修改角色")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@SaCheckPermission("roles:edit")
|
// @SaCheckPermission("roles:edit")
|
||||||
public ResponseEntity<Object> update(@Validated(Role.Update.class) @RequestBody Role resources) {
|
public ResponseEntity<Object> update(@RequestBody JSONObject param) {
|
||||||
getLevels(resources.getLevel());
|
roleService.update(param);
|
||||||
roleService.update(resources);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
@Log("修改角色菜单")
|
@Log("修改角色菜单")
|
||||||
@ApiOperation("修改角色菜单")
|
@ApiOperation("修改角色菜单")
|
||||||
@PutMapping(value = "/menu")
|
@PutMapping(value = "/menu")
|
||||||
// @SaCheckPermission("roles:edit")
|
// @SaCheckPermission("roles:edit")
|
||||||
public ResponseEntity<Object> updateMenu(@RequestBody JSONObject form) {
|
public ResponseEntity<Object> updateMenu(@RequestBody JSONObject form) {
|
||||||
String role_id = form.getString("id");
|
String role_id = form.getString("role_id");
|
||||||
JSONArray menus = form.getJSONArray("menus");
|
JSONArray menus = form.getJSONArray("menus");
|
||||||
WQLObject rmTab = WQLObject.getWQLObject("sys_roles_menus");
|
WQLObject rmTab = WQLObject.getWQLObject("sys_roles_menus");
|
||||||
rmTab.delete("role_id = " + role_id + "");
|
rmTab.delete("role_id = " + role_id + "");
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ public interface RoleService {
|
|||||||
*/
|
*/
|
||||||
<T> List<T> findRoles(Long id, Class<T>target);
|
<T> List<T> findRoles(Long id, Class<T>target);
|
||||||
|
|
||||||
RoleDto findById(Long id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
* @param form /
|
* @param form /
|
||||||
@@ -61,9 +59,9 @@ public interface RoleService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
* @param resources /
|
* @param form /
|
||||||
*/
|
*/
|
||||||
void update(Role resources);
|
void update(JSONObject form);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
@@ -78,12 +76,7 @@ public interface RoleService {
|
|||||||
*/
|
*/
|
||||||
List<RoleSmallDto> findByUsersId(Long id);
|
List<RoleSmallDto> findByUsersId(Long id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据角色查询角色级别
|
|
||||||
* @param roles /
|
|
||||||
* @return /
|
|
||||||
*/
|
|
||||||
Integer findByRoles(Set<Role> roles);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改绑定的菜单
|
* 修改绑定的菜单
|
||||||
@@ -97,20 +90,6 @@ public interface RoleService {
|
|||||||
* @param id /
|
* @param id /
|
||||||
*/
|
*/
|
||||||
void untiedMenu(Long id);
|
void untiedMenu(Long id);
|
||||||
/**
|
|
||||||
* 查询全部
|
|
||||||
* @param criteria 条件
|
|
||||||
* @return /
|
|
||||||
*/
|
|
||||||
List<RoleDto> queryAll(RoleQueryCriteria criteria);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户权限信息
|
|
||||||
* @param user 用户信息
|
|
||||||
* @return 权限信息
|
|
||||||
*/
|
|
||||||
// List<String> mapToGrantedAuthorities(UserDto user);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id获取用户的权限
|
* 通过id获取用户的权限
|
||||||
@@ -119,6 +98,4 @@ public interface RoleService {
|
|||||||
*/
|
*/
|
||||||
List<String> getPermissionList(JSONObject userDto);
|
List<String> getPermissionList(JSONObject userDto);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,21 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.modules.system.service.impl;
|
package org.nl.modules.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.modules.common.utils.enums.DataScopeEnum;
|
|
||||||
import org.nl.modules.system.domain.Dept;
|
|
||||||
import org.nl.modules.system.domain.User;
|
import org.nl.modules.system.domain.User;
|
||||||
import org.nl.modules.system.service.DataService;
|
import org.nl.modules.system.service.DataService;
|
||||||
import org.nl.modules.system.service.DeptService;
|
import org.nl.modules.system.service.DeptService;
|
||||||
import org.nl.modules.system.service.RoleService;
|
import org.nl.modules.system.service.RoleService;
|
||||||
import org.nl.modules.system.service.dto.RoleSmallDto;
|
import org.nl.modules.system.service.dto.RoleSmallDto;
|
||||||
import org.nl.modules.system.service.dto.UserDto;
|
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Zheng Jie
|
* @author Zheng Jie
|
||||||
@@ -51,7 +49,6 @@ public class DataServiceImpl implements DataService {
|
|||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "'user:' + #p0.id")
|
|
||||||
public List<Long> getDeptIds(User user) {
|
public List<Long> getDeptIds(User user) {
|
||||||
// 用于存储部门id
|
// 用于存储部门id
|
||||||
Set<Long> deptIds = new HashSet<>();
|
Set<Long> deptIds = new HashSet<>();
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import org.nl.modules.wql.WQL;
|
|||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.WqlUtil;
|
import org.nl.modules.wql.util.WqlUtil;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -116,7 +115,6 @@ public class DictDetailServiceImpl implements DictDetailService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "'name:' + #p0")
|
|
||||||
public List<DictDto> getDictByName(String name) {
|
public List<DictDto> getDictByName(String name) {
|
||||||
List<DictDto> dictDtos = this.findByDictName(name);
|
List<DictDto> dictDtos = this.findByDictName(name);
|
||||||
return dictDtos;
|
return dictDtos;
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// @Cacheable(key = "'id:' + #p0")
|
|
||||||
public MenuDto findById(String id) {
|
public MenuDto findById(String id) {
|
||||||
WQLObject menuTab = WQLObject.getWQLObject("sys_menu");
|
WQLObject menuTab = WQLObject.getWQLObject("sys_menu");
|
||||||
JSONObject json = menuTab.query("menu_id = '" + id + "'").uniqueResult(0);
|
JSONObject json = menuTab.query("menu_id = '" + id + "'").uniqueResult(0);
|
||||||
@@ -115,7 +114,6 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
// @Cacheable(key = "'user:' + #p0")
|
|
||||||
public List<MenuDto> findByUser(String currentUserId) {
|
public List<MenuDto> findByUser(String currentUserId) {
|
||||||
JSONArray arr = WQL.getWO("QSYS_MENU01").addParam("flag", "4").addParam("user_id", String.valueOf(currentUserId)).process().getResultJSONArray(0);
|
JSONArray arr = WQL.getWO("QSYS_MENU01").addParam("flag", "4").addParam("user_id", String.valueOf(currentUserId)).process().getResultJSONArray(0);
|
||||||
List<MenuDto> list = new ArrayList<>();
|
List<MenuDto> list = new ArrayList<>();
|
||||||
|
|||||||
@@ -15,11 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.modules.system.service.impl;
|
package org.nl.modules.system.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.CacheKey;
|
import org.nl.modules.common.utils.CacheKey;
|
||||||
import org.nl.modules.common.utils.RedisUtils;
|
import org.nl.modules.common.utils.RedisUtils;
|
||||||
import org.nl.modules.common.utils.SecurityUtils;
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
@@ -29,14 +33,12 @@ import org.nl.modules.system.service.RoleService;
|
|||||||
import org.nl.modules.system.service.dto.RoleDto;
|
import org.nl.modules.system.service.dto.RoleDto;
|
||||||
import org.nl.modules.system.service.dto.RoleQueryCriteria;
|
import org.nl.modules.system.service.dto.RoleQueryCriteria;
|
||||||
import org.nl.modules.system.service.dto.RoleSmallDto;
|
import org.nl.modules.system.service.dto.RoleSmallDto;
|
||||||
import org.nl.modules.tools.MapOf;
|
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.ResultBean;
|
import org.nl.modules.wql.core.bean.ResultBean;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.WqlUtil;
|
import org.nl.modules.wql.util.WqlUtil;
|
||||||
import org.nl.wms.util.IdUtil;
|
import org.nl.wms.util.IdUtil;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -45,8 +47,8 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Zheng Jie
|
* @author ludj
|
||||||
* @date 2018-12-03
|
* @date 2022-12-05
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -72,34 +74,30 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RoleDto> queryAll(RoleQueryCriteria criteria) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Cacheable(key = "'id:' + #p0")
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public <T> List<T> findRoles(Long id,Class<T> target) {
|
public <T> List<T> findRoles(Long id, Class<T> target) {
|
||||||
String sql = "is_used = '1' and is_delete = '0' ";
|
String sql = "is_used = '1' and is_delete = '0' ";
|
||||||
if (id != null){
|
if (id != null) {
|
||||||
sql=sql+"role_id = '"+id+"'";
|
sql = sql + "role_id = '" + id + "'";
|
||||||
}
|
}
|
||||||
JSONArray array = WQLObject.getWQLObject("sys_role").query(sql).getResultJSONArray(0);
|
JSONArray array = WQLObject.getWQLObject("sys_role").query(sql).getResultJSONArray(0);
|
||||||
return array.toJavaList(target);
|
return array.toJavaList(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public RoleDto findById(Long id) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(JSONObject form) {
|
public void create(JSONObject form) {
|
||||||
//角色表【sys_role】
|
//判断角色名字是否存在
|
||||||
|
String name = form.getString("name");
|
||||||
|
if (StrUtil.isEmpty(name)) throw new BadRequestException("角色名字不能为空!");
|
||||||
WQLObject roleTab = WQLObject.getWQLObject("sys_role");
|
WQLObject roleTab = WQLObject.getWQLObject("sys_role");
|
||||||
|
|
||||||
|
//判断角色名字是否存在
|
||||||
|
JSONObject json = roleTab.query("name = '" + name + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)) throw new BadRequestException("角色【" + name + "】已存在!");
|
||||||
|
|
||||||
|
|
||||||
String role_id = IdUtil.getStringId();
|
String role_id = IdUtil.getStringId();
|
||||||
form.put("role_id", role_id);
|
form.put("role_id", role_id);
|
||||||
form.put("create_id", SecurityUtils.getCurrentUserId());
|
form.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
@@ -114,8 +112,22 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(Role resources) {
|
public void update(JSONObject form) {
|
||||||
|
WQLObject roleTab = WQLObject.getWQLObject("sys_role");
|
||||||
|
//判断角色名字是否存在
|
||||||
|
String name = form.getString("name");
|
||||||
|
if (StrUtil.isEmpty(name)) throw new BadRequestException("角色名字不能为空!");
|
||||||
|
|
||||||
|
JSONObject json = roleTab.query("name = '" + name + "' and role_id <> '" + form.getString("role_id") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)) throw new BadRequestException("角色【" + name + "】已存在!");
|
||||||
|
|
||||||
|
String now = DateUtil.now();
|
||||||
|
form.put("update_id", StpUtil.getLoginIdAsLong());
|
||||||
|
form.put("update_time", now);
|
||||||
|
form.put("update_optname", SecurityUtils.getCurrentNickName());
|
||||||
|
|
||||||
|
|
||||||
|
roleTab.update(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -142,20 +154,11 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RoleSmallDto> findByUsersId(Long id) {
|
public List<RoleSmallDto> findByUsersId(Long id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer findByRoles(Set<Role> roles) {
|
|
||||||
Set<RoleDto> roleDtos = new HashSet<>();
|
|
||||||
for (Role role : roles) {
|
|
||||||
roleDtos.add(findById(role.getId()));
|
|
||||||
}
|
|
||||||
return Collections.min(roleDtos.stream().map(RoleDto::getLevel).collect(Collectors.toList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// @Cacheable(key = "'auth:' + #p0.id")
|
|
||||||
public List<String> getPermissionList(JSONObject userDto) {
|
public List<String> getPermissionList(JSONObject userDto) {
|
||||||
List<String> permission = new LinkedList<>();
|
List<String> permission = new LinkedList<>();
|
||||||
// 查看是否为管理员
|
// 查看是否为管理员
|
||||||
|
|||||||
@@ -22,21 +22,22 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.modules.common.config.FileProperties;
|
import org.nl.modules.common.config.FileProperties;
|
||||||
import org.nl.modules.common.exception.EntityExistException;
|
import org.nl.modules.common.exception.EntityExistException;
|
||||||
import org.nl.modules.common.exception.EntityNotFoundException;
|
import org.nl.modules.common.exception.EntityNotFoundException;
|
||||||
import org.nl.modules.common.utils.*;
|
import org.nl.modules.common.utils.CacheKey;
|
||||||
|
import org.nl.modules.common.utils.FileUtil;
|
||||||
|
import org.nl.modules.common.utils.RedisUtils;
|
||||||
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
import org.nl.modules.common.utils.dto.CurrentUser;
|
import org.nl.modules.common.utils.dto.CurrentUser;
|
||||||
import org.nl.modules.security.service.OnlineUserService;
|
import org.nl.modules.security.service.OnlineUserService;
|
||||||
import org.nl.modules.system.domain.User;
|
import org.nl.modules.system.domain.User;
|
||||||
import org.nl.modules.system.service.DeptService;
|
import org.nl.modules.system.service.DeptService;
|
||||||
import org.nl.modules.system.service.UserRelateService;
|
import org.nl.modules.system.service.UserRelateService;
|
||||||
import org.nl.modules.system.service.UserService;
|
import org.nl.modules.system.service.UserService;
|
||||||
|
|
||||||
import org.nl.modules.system.service.dto.UserQueryCriteria;
|
import org.nl.modules.system.service.dto.UserQueryCriteria;
|
||||||
import org.nl.modules.tools.MapOf;
|
import org.nl.modules.tools.MapOf;
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
@@ -44,17 +45,13 @@ import org.nl.modules.wql.core.bean.ResultBean;
|
|||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.WqlUtil;
|
import org.nl.modules.wql.util.WqlUtil;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -124,7 +121,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "'id:' + #p0")
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public User findById(long id) {
|
public User findById(long id) {
|
||||||
JSONObject result = WQLObject.getWQLObject("sys_user").query("user_id = '" + id + "'").uniqueResult(0);
|
JSONObject result = WQLObject.getWQLObject("sys_user").query("user_id = '" + id + "'").uniqueResult(0);
|
||||||
@@ -228,7 +224,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "'username:' + #p0")
|
|
||||||
public User findByName(String userName) {
|
public User findByName(String userName) {
|
||||||
JSONObject result = WQLObject.getWQLObject("sys_user").query("userName = '" + userName + "'").uniqueResult(0);
|
JSONObject result = WQLObject.getWQLObject("sys_user").query("userName = '" + userName + "'").uniqueResult(0);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 3.2 KiB |
BIN
nladmin-ui/src/assets/images/logo1.png
Normal file
BIN
nladmin-ui/src/assets/images/logo1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
BIN
nladmin-ui/src/assets/logo/logo.63028018.png
Normal file
BIN
nladmin-ui/src/assets/logo/logo.63028018.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
@@ -150,7 +150,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="permission" label="权限标识" :min-width="flexWidth('permission',crud.data,'权限标识')" />
|
<el-table-column prop="permission" label="权限标识" :min-width="flexWidth('permission',crud.data,'权限标识')" />
|
||||||
<el-table-column prop="component" label="组件路径" :min-width="flexWidth('component',crud.data,'组件路径')" />
|
<el-table-column prop="component" label="组件路径" min-width="120" />
|
||||||
<el-table-column prop="i_frame" label="外链" :formatter="crud.formatIsOrNot" :min-width="flexWidth('i_frame',crud.data,'外链')" />
|
<el-table-column prop="i_frame" label="外链" :formatter="crud.formatIsOrNot" :min-width="flexWidth('i_frame',crud.data,'外链')" />
|
||||||
|
|
||||||
<el-table-column prop="cache" label="缓存" :formatter="crud.formatIsOrNot" :min-width="flexWidth('cache',crud.data,'缓存')" />
|
<el-table-column prop="cache" label="缓存" :formatter="crud.formatIsOrNot" :min-width="flexWidth('cache',crud.data,'缓存')" />
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
class="filter-item"
|
class="filter-item"
|
||||||
@keyup.enter.native="crud.toQuery"
|
@keyup.enter.native="crud.toQuery"
|
||||||
/>
|
/>
|
||||||
<rrOperation />
|
<rrOperation/>
|
||||||
</div>
|
</div>
|
||||||
<crudOperation :permission="permission" />
|
<crudOperation :permission="permission"/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 表单渲染 -->
|
<!-- 表单渲染 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
@@ -28,10 +28,10 @@
|
|||||||
>
|
>
|
||||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" label-width="80px">
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||||
<el-form-item label="角色名称" prop="name">
|
<el-form-item label="角色名称" prop="name">
|
||||||
<el-input v-model="form.name" style="width: 380px;" />
|
<el-input v-model="form.name" style="width: 380px;"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="description">
|
<el-form-item label="备注" prop="description">
|
||||||
<el-input v-model="form.description" style="width: 380px;" rows="2" type="textarea" />
|
<el-input v-model="form.description" style="width: 380px;" rows="2" type="textarea"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@@ -55,9 +55,9 @@
|
|||||||
@selection-change="crud.selectionChangeHandler"
|
@selection-change="crud.selectionChangeHandler"
|
||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55"/>
|
||||||
<el-table-column prop="name" label="名称" min-width="100" show-overflow-tooltip />
|
<el-table-column prop="name" label="名称" min-width="100" show-overflow-tooltip/>
|
||||||
<el-table-column show-overflow-tooltip prop="description" label="描述" />
|
<el-table-column show-overflow-tooltip prop="description" label="描述"/>
|
||||||
<el-table-column show-overflow-tooltip width="135px" prop="createTime" label="创建日期">
|
<el-table-column show-overflow-tooltip width="135px" prop="createTime" label="创建日期">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!--分页组件-->
|
<!--分页组件-->
|
||||||
<pagination />
|
<pagination/>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- 菜单授权 -->
|
<!-- 菜单授权 -->
|
||||||
@@ -130,14 +130,13 @@ import rrOperation from '@crud/RR.operation'
|
|||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import DateRangePicker from '@/components/DateRangePicker'
|
|
||||||
|
|
||||||
const defaultForm = { id: null, name: null, description: null }
|
const defaultForm = { role_id: null, name: null, description: null }
|
||||||
export default {
|
export default {
|
||||||
name: 'Role',
|
name: 'Role',
|
||||||
components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker, crudMenu },
|
components: { pagination, crudOperation, rrOperation, udOperation, crudMenu },
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '角色', url: 'api/roles', crudMethod: { ...crudRoles }})
|
return CRUD({ idField: 'role_id', title: '角色', url: 'api/roles', crudMethod: { ...crudRoles } })
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
data() {
|
data() {
|
||||||
@@ -238,7 +237,7 @@ export default {
|
|||||||
// 保存菜单
|
// 保存菜单
|
||||||
saveMenu() {
|
saveMenu() {
|
||||||
this.menuLoading = true
|
this.menuLoading = true
|
||||||
const role = { id: this.currentId, menus: [] }
|
const role = { role_id: this.currentId, menus: [] }
|
||||||
// 得到已选中的 key 值
|
// 得到已选中的 key 值
|
||||||
this.menuIds.forEach(function(menu_id) {
|
this.menuIds.forEach(function(menu_id) {
|
||||||
const menu = { menu_id: menu_id }
|
const menu = { menu_id: menu_id }
|
||||||
|
|||||||
Reference in New Issue
Block a user