1
This commit is contained in:
@@ -58,7 +58,7 @@ public class SecurityUtils {
|
|||||||
*
|
*
|
||||||
* @return 系统用户Id
|
* @return 系统用户Id
|
||||||
*/
|
*/
|
||||||
public static Long getCurrentUserId() {
|
public static String getCurrentUserId() {
|
||||||
return getCurrentUser().getId();
|
return getCurrentUser().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class CurrentUser implements Serializable {
|
public class CurrentUser implements Serializable {
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long id;
|
private String id;
|
||||||
|
|
||||||
//账号
|
//账号
|
||||||
private String username;
|
private String username;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
|||||||
throw new BadRequestException("cron表达式格式错误");
|
throw new BadRequestException("cron表达式格式错误");
|
||||||
}
|
}
|
||||||
WQLObject quartzTab = WQLObject.getWQLObject("sys_quartz_job");
|
WQLObject quartzTab = WQLObject.getWQLObject("sys_quartz_job");
|
||||||
Long userId = SecurityUtils.getCurrentUserId();
|
String userId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
resources.put("job_id", IdUtil.getSnowflake(1,1).nextId());
|
resources.put("job_id", IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.nl.modules.system.rest;
|
|||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -10,6 +11,9 @@ import org.nl.modules.logging.annotation.Log;
|
|||||||
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.nl.system.service.role.ISysRoleService;
|
||||||
|
import org.nl.system.service.role.dao.SysRole;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
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;
|
||||||
|
|||||||
@@ -86,10 +86,10 @@ public class DictDetailServiceImpl implements DictDetailService {
|
|||||||
resources.setDict_id(IdUtil.getSnowflake(1, 1).nextId());
|
resources.setDict_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||||
resources.setCode(dictObj.getString("code"));
|
resources.setCode(dictObj.getString("code"));
|
||||||
resources.setName(dictObj.getString("name"));
|
resources.setName(dictObj.getString("name"));
|
||||||
resources.setCreate_id(SecurityUtils.getCurrentUserId());
|
resources.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||||
resources.setCreate_name(SecurityUtils.getCurrentNickName());
|
resources.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||||
resources.setCreate_time(DateUtil.now());
|
resources.setCreate_time(DateUtil.now());
|
||||||
resources.setUpdate_id(SecurityUtils.getCurrentUserId());
|
resources.setUpdate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||||
resources.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
resources.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||||
resources.setUpdate_time(DateUtil.now());
|
resources.setUpdate_time(DateUtil.now());
|
||||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(resources));
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(resources));
|
||||||
@@ -106,7 +106,7 @@ public class DictDetailServiceImpl implements DictDetailService {
|
|||||||
}
|
}
|
||||||
dto.setUpdate_time(DateUtil.now());
|
dto.setUpdate_time(DateUtil.now());
|
||||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||||
dto.setUpdate_id(SecurityUtils.getCurrentUserId());
|
dto.setUpdate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||||
dictTab.update(json);
|
dictTab.update(json);
|
||||||
// 清理缓存
|
// 清理缓存
|
||||||
|
|||||||
@@ -75,13 +75,13 @@ public class DictService2Impl implements DictService2 {
|
|||||||
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
||||||
JSONObject object = wo.query("code = '" + dto.getCode() + "'").uniqueResult(0);
|
JSONObject object = wo.query("code = '" + dto.getCode() + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(object)) throw new BadRequestException("字典[" + dto.getCode() + "]已存在");
|
if (ObjectUtil.isNotEmpty(object)) throw new BadRequestException("字典[" + dto.getCode() + "]已存在");
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String date = DateUtil.now();
|
String date = DateUtil.now();
|
||||||
dto.setDict_id(IdUtil.getSnowflake(1, 1).nextId());
|
dto.setDict_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||||
dto.setCreate_id(currentUserId);
|
dto.setCreate_id(Long.valueOf(currentUserId));
|
||||||
dto.setCreate_name(nickName);
|
dto.setCreate_name(nickName);
|
||||||
dto.setUpdate_id(currentUserId);
|
dto.setUpdate_id(Long.valueOf(currentUserId));
|
||||||
dto.setUpdate_optname(nickName);
|
dto.setUpdate_optname(nickName);
|
||||||
dto.setUpdate_time(date);
|
dto.setUpdate_time(date);
|
||||||
dto.setCreate_time(date);
|
dto.setCreate_time(date);
|
||||||
@@ -93,7 +93,7 @@ public class DictService2Impl implements DictService2 {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(DictDto dto) {
|
public void update(DictDto dto) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
JSONObject otherObj = wo.query("dict_id = '" + dto.getDict_id() + "'").uniqueResult(0);
|
JSONObject otherObj = wo.query("dict_id = '" + dto.getDict_id() + "'").uniqueResult(0);
|
||||||
JSONArray dictArray = wo.query("code = '" + otherObj.getString("code") + "'").getResultJSONArray(0);
|
JSONArray dictArray = wo.query("code = '" + otherObj.getString("code") + "'").getResultJSONArray(0);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class GenCodeServiceImpl implements GenCodeService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(Map form) {
|
public void create(Map form) {
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
WQLObject wql = WQLObject.getWQLObject("sys_code_rule");
|
WQLObject wql = WQLObject.getWQLObject("sys_code_rule");
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class GridFieldServiceImpl implements GridFieldService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(GridFieldDto dto) {
|
public void create(GridFieldDto dto) {
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
Long uid = SecurityUtils.getCurrentUserId();
|
String uid = SecurityUtils.getCurrentUserId();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
dto.setId(IdUtil.simpleUUID());
|
dto.setId(IdUtil.simpleUUID());
|
||||||
@@ -108,7 +108,7 @@ public class GridFieldServiceImpl implements GridFieldService {
|
|||||||
JSONArray fieldDatas = json.getJSONArray("gridFieldData");
|
JSONArray fieldDatas = json.getJSONArray("gridFieldData");
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
// 先删除原先所有的数据
|
// 先删除原先所有的数据
|
||||||
wo.delete("grid_id = '" + grid_id + "'");
|
wo.delete("grid_id = '" + grid_id + "'");
|
||||||
// 然后添加
|
// 然后添加
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class GridServiceImpl implements GridService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(GridDto dto) {
|
public void create(GridDto dto) {
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
Long uid = SecurityUtils.getCurrentUserId();
|
String uid = SecurityUtils.getCurrentUserId();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
dto.setId(IdUtil.simpleUUID());
|
dto.setId(IdUtil.simpleUUID());
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
|||||||
throw new BadRequestException("上传失败");
|
throw new BadRequestException("上传失败");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Long userId = SecurityUtils.getCurrentUserId();
|
String userId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
name = StrUtil.isEmpty(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name;
|
name = StrUtil.isEmpty(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name;
|
||||||
|
|||||||
@@ -74,14 +74,14 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(DataPermissionDto dto) {
|
public void create(DataPermissionDto dto) {
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
dto.setPermission_id(IdUtil.getSnowflake(1, 1).nextId());
|
dto.setPermission_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||||
dto.setCreate_id(currentUserId);
|
dto.setCreate_id(Long.valueOf(currentUserId));
|
||||||
dto.setCreate_name(nickName);
|
dto.setCreate_name(nickName);
|
||||||
dto.setUpdate_id(currentUserId);
|
dto.setUpdate_id(Long.valueOf(currentUserId));
|
||||||
dto.setUpdate_optname(nickName);
|
dto.setUpdate_optname(nickName);
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
@@ -97,12 +97,12 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
|||||||
DataPermissionDto entity = this.findById(dto.getPermission_id());
|
DataPermissionDto entity = this.findById(dto.getPermission_id());
|
||||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
|
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setUpdate_id(currentUserId);
|
dto.setUpdate_id(Long.valueOf(currentUserId));
|
||||||
dto.setUpdate_optname(nickName);
|
dto.setUpdate_optname(nickName);
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_data_permission");
|
WQLObject wo = WQLObject.getWQLObject("sys_data_permission");
|
||||||
@@ -113,7 +113,7 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteAll(Long[] ids) {
|
public void deleteAll(Long[] ids) {
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(Dict dict) {
|
public void create(Dict dict) {
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String date = DateUtil.now();
|
String date = DateUtil.now();
|
||||||
Dict oldDict = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>()
|
Dict oldDict = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>()
|
||||||
@@ -64,8 +64,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
dict.setCreateId(currentUserId);
|
dict.setCreateId(currentUserId);
|
||||||
dict.setCreateName(nickName);
|
dict.setCreateName(nickName);
|
||||||
dict.setCreateTime(date);
|
dict.setCreateTime(date);
|
||||||
dict.setupdateId(currentUserId);
|
dict.setUpdateId(currentUserId);
|
||||||
dict.setupdateName(nickName);
|
dict.setUpdateName(nickName);
|
||||||
dict.setUpdateTime(date);
|
dict.setUpdateTime(date);
|
||||||
sysDictMapper.insert(dict);
|
sysDictMapper.insert(dict);
|
||||||
}
|
}
|
||||||
@@ -76,15 +76,15 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
Dict dict1 = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dto.getCode()));
|
Dict dict1 = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dto.getCode()));
|
||||||
if (ObjectUtil.isNotEmpty(dict1)) throw new BadRequestException("字典[" + dict1.getCode() + "]已存在");
|
if (ObjectUtil.isNotEmpty(dict1)) throw new BadRequestException("字典[" + dict1.getCode() + "]已存在");
|
||||||
Dict dict = sysDictMapper.selectById(dto.getDictId());
|
Dict dict = sysDictMapper.selectById(dto.getDictId());
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||||
// 根据code获取所有字典
|
// 根据code获取所有字典
|
||||||
List<Dict> dicts = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
|
List<Dict> dicts = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
|
||||||
dicts.forEach(di -> {
|
dicts.forEach(di -> {
|
||||||
di.setCode(dto.getCode());
|
di.setCode(dto.getCode());
|
||||||
di.setName(dto.getName());
|
di.setName(dto.getName());
|
||||||
di.setupdateId(currentUserId);
|
di.setUpdateId(currentUserId);
|
||||||
di.setupdateName(currentNickName);
|
di.setUpdateName(currentNickName);
|
||||||
di.setUpdateTime(DateUtil.now());
|
di.setUpdateTime(DateUtil.now());
|
||||||
sysDictMapper.updateById(di);
|
sysDictMapper.updateById(di);
|
||||||
});
|
});
|
||||||
@@ -139,8 +139,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
dict.setCreateId(SecurityUtils.getCurrentUserId());
|
dict.setCreateId(SecurityUtils.getCurrentUserId());
|
||||||
dict.setCreateName(SecurityUtils.getCurrentNickName());
|
dict.setCreateName(SecurityUtils.getCurrentNickName());
|
||||||
dict.setCreateTime(DateUtil.now());
|
dict.setCreateTime(DateUtil.now());
|
||||||
dict.setupdateId(SecurityUtils.getCurrentUserId());
|
dict.setUpdateId(SecurityUtils.getCurrentUserId());
|
||||||
dict.setupdateName(SecurityUtils.getCurrentNickName());
|
dict.setUpdateName(SecurityUtils.getCurrentNickName());
|
||||||
dict.setUpdateTime(DateUtil.now());
|
dict.setUpdateTime(DateUtil.now());
|
||||||
sysDictMapper.insert(dict);
|
sysDictMapper.insert(dict);
|
||||||
}
|
}
|
||||||
@@ -154,8 +154,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
Dict one = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getLabel, dict.getLabel())
|
Dict one = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getLabel, dict.getLabel())
|
||||||
.eq(Dict::getCode, dict.getCode()));
|
.eq(Dict::getCode, dict.getCode()));
|
||||||
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
|
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
|
||||||
resources.setupdateId(SecurityUtils.getCurrentUserId());
|
resources.setUpdateId(SecurityUtils.getCurrentUserId());
|
||||||
resources.setupdateName(SecurityUtils.getCurrentNickName());
|
resources.setUpdateName(SecurityUtils.getCurrentNickName());
|
||||||
resources.setUpdateTime(DateUtil.now());
|
resources.setUpdateTime(DateUtil.now());
|
||||||
sysDictMapper.updateById(resources);
|
sysDictMapper.updateById(resources);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public interface ISysMenuService extends IService<SysMenu> {
|
|||||||
void update(SysMenu menu);
|
void update(SysMenu menu);
|
||||||
|
|
||||||
|
|
||||||
List<MenuDto> findByUser(Long userId);
|
List<MenuDto> findByUser(String userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建菜单树
|
* 构建菜单树
|
||||||
|
|||||||
@@ -28,6 +28,6 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
|||||||
* @param userId 用户标识
|
* @param userId 用户标识
|
||||||
* @return 当前用户拥有的菜单列表
|
* @return 当前用户拥有的菜单列表
|
||||||
*/
|
*/
|
||||||
List<SysMenu> findByUser(@Param("userId") Long userId);
|
List<SysMenu> findByUser(@Param("userId") String userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MenuDto> findByUser(Long userId) {
|
public List<MenuDto> findByUser(String userId) {
|
||||||
return baseMapper.findByUser(userId).stream().map(menu -> this.doToDto(menu)).collect(Collectors.toList());
|
return baseMapper.findByUser(userId).stream().map(menu -> this.doToDto(menu)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,14 +48,14 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
|||||||
List code = paramMapper.selectByMap(MapOf.of("code", param.getCode()));
|
List code = paramMapper.selectByMap(MapOf.of("code", param.getCode()));
|
||||||
if (ObjectUtil.isNotEmpty(code)) throw new BadRequestException("编码不能一致");
|
if (ObjectUtil.isNotEmpty(code)) throw new BadRequestException("编码不能一致");
|
||||||
param.setId(IdUtil.getSnowflake(1,1).nextIdStr());
|
param.setId(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
param.setCreateId(currentUserId);
|
param.setCreateId(currentUserId);
|
||||||
param.setCreateName(nickName);
|
param.setCreateName(nickName);
|
||||||
param.setCreateTime(now);
|
param.setCreateTime(now);
|
||||||
param.setupdateId(currentUserId);
|
param.setUpdateId(currentUserId);
|
||||||
param.setupdateName(nickName);
|
param.setUpdateName(nickName);
|
||||||
param.setUpdateTime(now);
|
param.setUpdateTime(now);
|
||||||
paramMapper.insert(param);
|
paramMapper.insert(param);
|
||||||
}
|
}
|
||||||
@@ -65,8 +65,8 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
|||||||
public void update(Param param) {
|
public void update(Param param) {
|
||||||
Param paramObj = paramMapper.selectById(param.getId());
|
Param paramObj = paramMapper.selectById(param.getId());
|
||||||
if (ObjectUtil.isEmpty(paramObj)) throw new BadRequestException("被删除或无权限,操作失败!");
|
if (ObjectUtil.isEmpty(paramObj)) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
param.setupdateId(SecurityUtils.getCurrentUserId());
|
param.setUpdateId(SecurityUtils.getCurrentUserId());
|
||||||
param.setupdateName(SecurityUtils.getCurrentNickName());
|
param.setUpdateName(SecurityUtils.getCurrentNickName());
|
||||||
param.setUpdateTime(DateUtil.now());
|
param.setUpdateTime(DateUtil.now());
|
||||||
paramMapper.updateById(param);
|
paramMapper.updateById(param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||||||
//判断角色名字是否存在
|
//判断角色名字是否存在
|
||||||
SysRole role = roleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getName, sysRole.getName()));
|
SysRole role = roleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getName, sysRole.getName()));
|
||||||
if (ObjectUtil.isNotEmpty(role)) throw new BadRequestException("角色【" + name + "】已存在!");
|
if (ObjectUtil.isNotEmpty(role)) throw new BadRequestException("角色【" + name + "】已存在!");
|
||||||
Long userId = SecurityUtils.getCurrentUserId();
|
String userId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
// 插入
|
// 插入
|
||||||
@@ -93,7 +93,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||||||
SysRole role = roleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getName, sysRole.getName())
|
SysRole role = roleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getName, sysRole.getName())
|
||||||
.ne(SysRole::getRoleId, sysRole.getRoleId()));
|
.ne(SysRole::getRoleId, sysRole.getRoleId()));
|
||||||
if (ObjectUtil.isNotEmpty(role)) throw new BadRequestException("角色【" + name + "】已存在!");
|
if (ObjectUtil.isNotEmpty(role)) throw new BadRequestException("角色【" + name + "】已存在!");
|
||||||
Long userId = SecurityUtils.getCurrentUserId();
|
String userId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
sysRole.setUpdateId(userId);
|
sysRole.setUpdateId(userId);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class ${className}ServiceImpl implements ${className}Service {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(${className}Dto dto) {
|
public void create(${className}Dto dto) {
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class ${className}ServiceImpl implements ${className}Service {
|
|||||||
${className}Dto entity = this.findById(dto.get${pkChangeColName ? cap_first }());
|
${className}Dto entity = this.findById(dto.get${pkChangeColName ? cap_first }());
|
||||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
|
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
@@ -112,7 +112,7 @@ public class ${className}ServiceImpl implements ${className}Service {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteAll(${pkColumnType}[] ids) {
|
public void deleteAll(${pkColumnType}[] ids) {
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
package org.nl.sso;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.nl.AppRun;
|
|
||||||
import org.nl.system.service.dict.ISysDictService;
|
|
||||||
import org.nl.system.service.dict.dao.Dict;
|
|
||||||
import org.nl.system.service.dict.dao.mapper.SysDictMapper;
|
|
||||||
import org.nl.system.service.role.dao.mapper.SysRoleMapper;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: lyd
|
|
||||||
* @Description:
|
|
||||||
* @Date: 2022/12/14
|
|
||||||
*/
|
|
||||||
@SpringBootTest(classes = AppRun.class)
|
|
||||||
public class DictTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
SysDictMapper sysDictMapper;
|
|
||||||
@Autowired
|
|
||||||
SysRoleMapper sysRoleMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
ISysDictService ISysDictService;
|
|
||||||
@Test
|
|
||||||
void QueryTest() {
|
|
||||||
String blurry = null;
|
|
||||||
// QueryWrapper<Dict> queryWrapper = new QueryWrapper<>();
|
|
||||||
// if (ObjectUtil.isNotEmpty(blurry)) {
|
|
||||||
// queryWrapper.like("code", blurry)
|
|
||||||
// .or()
|
|
||||||
// .like("name", blurry);
|
|
||||||
// }
|
|
||||||
// queryWrapper.orderBy(true, true, "code");
|
|
||||||
// Page<Dict> dictPage = new Page<>(0, 3);
|
|
||||||
// IPage<Dict> dictIPage = dictMapper.selectPage(dictPage, queryWrapper);
|
|
||||||
LambdaQueryWrapper<Dict> lam = new LambdaQueryWrapper<>();
|
|
||||||
lam.like(ObjectUtil.isNotEmpty(blurry), Dict::getCode, blurry)
|
|
||||||
.or(ObjectUtil.isNotEmpty(blurry))
|
|
||||||
.like(ObjectUtil.isNotEmpty(blurry), Dict::getName, blurry);
|
|
||||||
IPage<Dict> pages = new Page<>(0, 3);
|
|
||||||
sysDictMapper.selectPage(pages, lam);
|
|
||||||
pages.getRecords().forEach(System.out::println);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void show() {
|
|
||||||
sysRoleMapper.list().forEach(sysRole -> System.out.println(sysRole));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package org.nl.sso;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.nl.AppRun;
|
|
||||||
import org.nl.system.service.menu.ISysMenuService;
|
|
||||||
import org.nl.system.service.menu.dao.SysMenu;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @author ZZQ
|
|
||||||
* @Date 2022/12/14 4:59 下午
|
|
||||||
*/
|
|
||||||
//@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = AppRun.class)
|
|
||||||
public class MybatisTest {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
ISysMenuService iSysMenuService;
|
|
||||||
@Test
|
|
||||||
public void mybatisTest(){
|
|
||||||
List<SysMenu> sysUsers = iSysMenuService.findByPid(1597878521852727297L);
|
|
||||||
System.out.println(sysUsers);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package org.nl.sso;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
class NlssoServerApplicationTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void contextLoads() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
package org.nl.sso;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.nl.AppRun;
|
|
||||||
import org.nl.modules.tools.IdUtil;
|
|
||||||
import org.nl.modules.tools.MapOf;
|
|
||||||
import org.nl.system.service.param.ISysParamService;
|
|
||||||
import org.nl.system.service.param.dao.Param;
|
|
||||||
import org.nl.system.service.param.dao.mapper.SysParamMapper;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: lyd
|
|
||||||
* @Description:
|
|
||||||
* @Date: 2022/12/14
|
|
||||||
*/
|
|
||||||
@SpringBootTest(classes = AppRun.class)
|
|
||||||
public class ParamTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
ISysParamService paramService;
|
|
||||||
@Autowired
|
|
||||||
SysParamMapper paramMapper;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void createTest(){
|
|
||||||
Param param = new Param();
|
|
||||||
param.setId(IdUtil.getStringId());
|
|
||||||
param.setCode("ccc");
|
|
||||||
param.setName("测试code");
|
|
||||||
param.setValue("1");
|
|
||||||
param.setCreateId(1L);
|
|
||||||
param.setCreateName("admin");
|
|
||||||
param.setCreateTime(DateUtil.now());
|
|
||||||
paramService.create(param);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void updateTest(){
|
|
||||||
Param o = (Param) paramMapper.selectByMap(MapOf.of("code", "ccc")).get(0);
|
|
||||||
o.setName("测试2");
|
|
||||||
paramService.update(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void deleteTest(){
|
|
||||||
Param o = (Param) paramMapper.selectByMap(MapOf.of("code", "codess")).get(0);
|
|
||||||
String[] ids = new String[2];
|
|
||||||
ids[0] = o.getId();
|
|
||||||
paramService.removeByIds(Arrays.asList(ids));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user