Merge branch 'master' of https://gitee.com/y_project/RuoYi-Cloud into only-master

This commit is contained in:
thinkcodee
2022-06-27 09:29:08 +08:00
27 changed files with 155 additions and 386 deletions

View File

@@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.constant.GenConstants;
import com.ruoyi.common.core.exception.ServiceException;
@@ -401,7 +401,7 @@ public class GenTableServiceImpl implements IGenTableService
if (GenConstants.TPL_TREE.equals(genTable.getTplCategory()))
{
String options = JSON.toJSONString(genTable.getParams());
JSONObject paramsObj = JSONObject.parseObject(options);
JSONObject paramsObj = JSON.parseObject(options);
if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE)))
{
throw new ServiceException("树编码字段不能为空");
@@ -485,7 +485,7 @@ public class GenTableServiceImpl implements IGenTableService
*/
public void setTableFromOptions(GenTable genTable)
{
JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions());
JSONObject paramsObj = JSON.parseObject(genTable.getOptions());
if (StringUtils.isNotNull(paramsObj))
{
String treeCode = paramsObj.getString(GenConstants.TREE_CODE);

View File

@@ -5,7 +5,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.velocity.VelocityContext;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.constant.GenConstants;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
@@ -75,7 +76,7 @@ public class VelocityUtils
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable)
{
String options = genTable.getOptions();
JSONObject paramsObj = JSONObject.parseObject(options);
JSONObject paramsObj = JSON.parseObject(options);
String parentMenuId = getParentMenuId(paramsObj);
context.put("parentMenuId", parentMenuId);
}
@@ -83,7 +84,7 @@ public class VelocityUtils
public static void setTreeVelocityContext(VelocityContext context, GenTable genTable)
{
String options = genTable.getOptions();
JSONObject paramsObj = JSONObject.parseObject(options);
JSONObject paramsObj = JSON.parseObject(options);
String treeCode = getTreecode(paramsObj);
String treeParentCode = getTreeParentCode(paramsObj);
String treeName = getTreeName(paramsObj);
@@ -381,7 +382,7 @@ public class VelocityUtils
public static int getExpandColumn(GenTable genTable)
{
String options = genTable.getOptions();
JSONObject paramsObj = JSONObject.parseObject(options);
JSONObject paramsObj = JSON.parseObject(options);
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
int num = 0;
for (GenTableColumn column : genTable.getColumns())

View File

@@ -1,7 +1,6 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.system.api.domain.SysDictType;
/**
@@ -9,7 +8,6 @@ import com.ruoyi.system.api.domain.SysDictType;
*
* @author ruoyi
*/
@Mapper
public interface SysDictTypeMapper
{
/**

View File

@@ -381,23 +381,7 @@ public class SysUserServiceImpl implements ISysUserService
*/
public void insertUserRole(SysUser user)
{
Long[] roles = user.getRoleIds();
if (StringUtils.isNotNull(roles))
{
// 新增用户与角色管理
List<SysUserRole> list = new ArrayList<SysUserRole>();
for (Long roleId : roles)
{
SysUserRole ur = new SysUserRole();
ur.setUserId(user.getUserId());
ur.setRoleId(roleId);
list.add(ur);
}
if (list.size() > 0)
{
userRoleMapper.batchUserRole(list);
}
}
this.insertUserRole(user.getUserId(), user.getRoleIds());
}
/**
@@ -408,7 +392,7 @@ public class SysUserServiceImpl implements ISysUserService
public void insertUserPost(SysUser user)
{
Long[] posts = user.getPostIds();
if (StringUtils.isNotNull(posts))
if (StringUtils.isNotEmpty(posts))
{
// 新增用户与岗位管理
List<SysUserPost> list = new ArrayList<SysUserPost>();
@@ -419,10 +403,7 @@ public class SysUserServiceImpl implements ISysUserService
up.setPostId(postId);
list.add(up);
}
if (list.size() > 0)
{
userPostMapper.batchUserPost(list);
}
userPostMapper.batchUserPost(list);
}
}
@@ -434,7 +415,7 @@ public class SysUserServiceImpl implements ISysUserService
*/
public void insertUserRole(Long userId, Long[] roleIds)
{
if (StringUtils.isNotNull(roleIds))
if (StringUtils.isNotEmpty(roleIds))
{
// 新增用户与角色管理
List<SysUserRole> list = new ArrayList<SysUserRole>();
@@ -445,10 +426,7 @@ public class SysUserServiceImpl implements ISysUserService
ur.setRoleId(roleId);
list.add(ur);
}
if (list.size() > 0)
{
userRoleMapper.batchUserRole(list);
}
userRoleMapper.batchUserRole(list);
}
}

View File

@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userId != null and userId != 0">