diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/RoleController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/RoleController.java index 9788afb..e0c5662 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/RoleController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/RoleController.java @@ -7,14 +7,12 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; 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.service.RoleService; import org.nl.modules.wql.core.bean.WQLObject; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -22,8 +20,8 @@ import java.util.Map; import java.util.Set; /** - * @author Zheng Jie - * @date 2018-12-03 + * @author ludj + * @date 2022-12-05 */ @RestController @RequiredArgsConstructor @@ -33,14 +31,6 @@ public class RoleController { private final RoleService roleService; - private static final String ENTITY_NAME = "role"; - - @ApiOperation("获取单个role") - @GetMapping(value = "/{id}") - @SaCheckPermission("roles:list") - public ResponseEntity query(@PathVariable Long id) { - return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK); - } @ApiOperation("获取单个role") @GetMapping(value = "/all") @@ -61,28 +51,27 @@ public class RoleController { @Log("新增角色") @ApiOperation("新增角色") @PostMapping - @SaCheckPermission("roles:add") - public ResponseEntity create(@Validated @RequestBody Role resources) { -// roleService.create(resources); +// @SaCheckPermission("roles:add") + public ResponseEntity create(@RequestBody JSONObject param) { + roleService.create(param); return new ResponseEntity<>(HttpStatus.CREATED); } - /* @Log("修改角色") - @ApiOperation("修改角色") - @PutMapping - @SaCheckPermission("roles:edit") - public ResponseEntity update(@Validated(Role.Update.class) @RequestBody Role resources) { - getLevels(resources.getLevel()); - roleService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - */ + @Log("修改角色") + @ApiOperation("修改角色") + @PutMapping +// @SaCheckPermission("roles:edit") + public ResponseEntity update(@RequestBody JSONObject param) { + roleService.update(param); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + @Log("修改角色菜单") @ApiOperation("修改角色菜单") @PutMapping(value = "/menu") // @SaCheckPermission("roles:edit") public ResponseEntity updateMenu(@RequestBody JSONObject form) { - String role_id = form.getString("id"); + String role_id = form.getString("role_id"); JSONArray menus = form.getJSONArray("menus"); WQLObject rmTab = WQLObject.getWQLObject("sys_roles_menus"); rmTab.delete("role_id = " + role_id + ""); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/RoleService.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/RoleService.java index bc98ff7..d1890f8 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/RoleService.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/RoleService.java @@ -51,8 +51,6 @@ public interface RoleService { */ List findRoles(Long id, Classtarget); - RoleDto findById(Long id); - /** * 创建 * @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 findByUsersId(Long id); - /** - * 根据角色查询角色级别 - * @param roles / - * @return / - */ - Integer findByRoles(Set roles); + /** * 修改绑定的菜单 @@ -97,20 +90,6 @@ public interface RoleService { * @param id / */ void untiedMenu(Long id); - /** - * 查询全部 - * @param criteria 条件 - * @return / - */ - List queryAll(RoleQueryCriteria criteria); - - - /** - * 获取用户权限信息 - * @param user 用户信息 - * @return 权限信息 - */ -// List mapToGrantedAuthorities(UserDto user); /** * 通过id获取用户的权限 @@ -119,6 +98,4 @@ public interface RoleService { */ List getPermissionList(JSONObject userDto); - - } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DataServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DataServiceImpl.java index d3a3d8b..cfae8fc 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DataServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DataServiceImpl.java @@ -15,21 +15,19 @@ */ package org.nl.modules.system.service.impl; -import cn.hutool.core.util.ObjectUtil; 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.service.DataService; import org.nl.modules.system.service.DeptService; import org.nl.modules.system.service.RoleService; 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.Cacheable; 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 @@ -51,7 +49,6 @@ public class DataServiceImpl implements DataService { * @return / */ @Override - @Cacheable(key = "'user:' + #p0.id") public List getDeptIds(User user) { // 用于存储部门id Set deptIds = new HashSet<>(); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DictDetailServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DictDetailServiceImpl.java index c3ff78f..295ccff 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DictDetailServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DictDetailServiceImpl.java @@ -32,7 +32,6 @@ import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.WqlUtil; import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -116,7 +115,6 @@ public class DictDetailServiceImpl implements DictDetailService { } @Override - @Cacheable(key = "'name:' + #p0") public List getDictByName(String name) { List dictDtos = this.findByDictName(name); return dictDtos; diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java index 1c6ecf2..8d8a4f6 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java @@ -101,7 +101,6 @@ public class MenuServiceImpl implements MenuService { @Override -// @Cacheable(key = "'id:' + #p0") public MenuDto findById(String id) { WQLObject menuTab = WQLObject.getWQLObject("sys_menu"); JSONObject json = menuTab.query("menu_id = '" + id + "'").uniqueResult(0); @@ -115,7 +114,6 @@ public class MenuServiceImpl implements MenuService { * @return / */ @Override -// @Cacheable(key = "'user:' + #p0") public List findByUser(String currentUserId) { JSONArray arr = WQL.getWO("QSYS_MENU01").addParam("flag", "4").addParam("user_id", String.valueOf(currentUserId)).process().getResultJSONArray(0); List list = new ArrayList<>(); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/RoleServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/RoleServiceImpl.java index 52c0ba0..3ba2342 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/RoleServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/RoleServiceImpl.java @@ -15,11 +15,15 @@ */ package org.nl.modules.system.service.impl; +import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.collection.CollectionUtil; 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.JSONObject; import lombok.RequiredArgsConstructor; +import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.CacheKey; import org.nl.modules.common.utils.RedisUtils; 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.RoleQueryCriteria; 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.core.bean.ResultBean; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.WqlUtil; import org.nl.wms.util.IdUtil; import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -45,8 +47,8 @@ import java.util.*; import java.util.stream.Collectors; /** - * @author Zheng Jie - * @date 2018-12-03 + * @author ludj + * @date 2022-12-05 */ @Service @RequiredArgsConstructor @@ -72,34 +74,30 @@ public class RoleServiceImpl implements RoleService { } @Override - public List queryAll(RoleQueryCriteria criteria) { - return null; - } - - - @Override - @Cacheable(key = "'id:' + #p0") @Transactional(rollbackFor = Exception.class) - public List findRoles(Long id,Class target) { + public List findRoles(Long id, Class target) { String sql = "is_used = '1' and is_delete = '0' "; - if (id != null){ - sql=sql+"role_id = '"+id+"'"; + if (id != null) { + sql = sql + "role_id = '" + id + "'"; } 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 @Transactional(rollbackFor = Exception.class) 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"); + //判断角色名字是否存在 + JSONObject json = roleTab.query("name = '" + name + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json)) throw new BadRequestException("角色【" + name + "】已存在!"); + + String role_id = IdUtil.getStringId(); form.put("role_id", role_id); form.put("create_id", SecurityUtils.getCurrentUserId()); @@ -114,8 +112,22 @@ public class RoleServiceImpl implements RoleService { @Override @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 @@ -142,20 +154,11 @@ public class RoleServiceImpl implements RoleService { @Override public List findByUsersId(Long id) { - return null; + return null; } - @Override - public Integer findByRoles(Set roles) { - Set roleDtos = new HashSet<>(); - for (Role role : roles) { - roleDtos.add(findById(role.getId())); - } - return Collections.min(roleDtos.stream().map(RoleDto::getLevel).collect(Collectors.toList())); - } @Override -// @Cacheable(key = "'auth:' + #p0.id") public List getPermissionList(JSONObject userDto) { List permission = new LinkedList<>(); // 查看是否为管理员 diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java index bf97a8a..7a1fb1f 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/UserServiceImpl.java @@ -22,21 +22,22 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.serializer.SerializeConfig; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import org.apache.commons.lang3.StringUtils; import org.nl.modules.common.config.FileProperties; import org.nl.modules.common.exception.EntityExistException; 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.security.service.OnlineUserService; import org.nl.modules.system.domain.User; import org.nl.modules.system.service.DeptService; import org.nl.modules.system.service.UserRelateService; import org.nl.modules.system.service.UserService; - import org.nl.modules.system.service.dto.UserQueryCriteria; import org.nl.modules.tools.MapOf; 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.util.WqlUtil; import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; -import javax.validation.constraints.NotBlank; import java.io.File; -import java.io.IOException; import java.util.*; import java.util.stream.Collectors; @@ -124,7 +121,6 @@ public class UserServiceImpl implements UserService { } @Override - @Cacheable(key = "'id:' + #p0") @Transactional(rollbackFor = Exception.class) public User findById(long id) { JSONObject result = WQLObject.getWQLObject("sys_user").query("user_id = '" + id + "'").uniqueResult(0); @@ -228,7 +224,6 @@ public class UserServiceImpl implements UserService { } @Override - @Cacheable(key = "'username:' + #p0") public User findByName(String userName) { JSONObject result = WQLObject.getWQLObject("sys_user").query("userName = '" + userName + "'").uniqueResult(0); if (result == null) { diff --git a/nladmin-ui/src/assets/images/logo.png b/nladmin-ui/src/assets/images/logo.png index f757710..fbfa3c9 100644 Binary files a/nladmin-ui/src/assets/images/logo.png and b/nladmin-ui/src/assets/images/logo.png differ diff --git a/nladmin-ui/src/assets/images/logo1.png b/nladmin-ui/src/assets/images/logo1.png new file mode 100644 index 0000000..f757710 Binary files /dev/null and b/nladmin-ui/src/assets/images/logo1.png differ diff --git a/nladmin-ui/src/assets/logo/logo.63028018.png b/nladmin-ui/src/assets/logo/logo.63028018.png new file mode 100644 index 0000000..fbfa3c9 Binary files /dev/null and b/nladmin-ui/src/assets/logo/logo.63028018.png differ diff --git a/nladmin-ui/src/views/system/menu/index.vue b/nladmin-ui/src/views/system/menu/index.vue index ff0c196..d7abcc5 100644 --- a/nladmin-ui/src/views/system/menu/index.vue +++ b/nladmin-ui/src/views/system/menu/index.vue @@ -150,7 +150,7 @@ - + diff --git a/nladmin-ui/src/views/system/role/index.vue b/nladmin-ui/src/views/system/role/index.vue index 6348646..c7206a5 100644 --- a/nladmin-ui/src/views/system/role/index.vue +++ b/nladmin-ui/src/views/system/role/index.vue @@ -13,9 +13,9 @@ class="filter-item" @keyup.enter.native="crud.toQuery" /> - + - + - + - +