master
parent
b7150b6b29
commit
4189889b72
|
@ -0,0 +1,24 @@
|
||||||
|
package com.jing.common.core.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务名称
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class ServiceNameConstants
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 认证服务的serviceid
|
||||||
|
*/
|
||||||
|
public static final String AUTH_SERVICE = "jing-auth";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统模块的serviceid
|
||||||
|
*/
|
||||||
|
public static final String SYSTEM_SERVICE = "jing-system";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件服务的serviceid
|
||||||
|
*/
|
||||||
|
public static final String FILE_SERVICE = "jing-file";
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.jing.common.core.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务异常
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public final class ServiceException extends RuntimeException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误提示
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误明细,内部调试错误
|
||||||
|
*
|
||||||
|
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||||
|
*/
|
||||||
|
private String detailMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空构造方法,避免反序列化问题
|
||||||
|
*/
|
||||||
|
public ServiceException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceException(String message)
|
||||||
|
{
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceException(String message, Integer code)
|
||||||
|
{
|
||||||
|
this.message = message;
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDetailMessage()
|
||||||
|
{
|
||||||
|
return detailMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage()
|
||||||
|
{
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCode()
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceException setMessage(String message)
|
||||||
|
{
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceException setDetailMessage(String detailMessage)
|
||||||
|
{
|
||||||
|
this.detailMessage = detailMessage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.jing.common.core.utils.uuid;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import com.jing.common.core.utils.DateUtils;
|
||||||
|
import com.jing.common.core.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ruoyi 序列生成类
|
||||||
|
*/
|
||||||
|
public class Seq
|
||||||
|
{
|
||||||
|
// 通用序列类型
|
||||||
|
public static final String commSeqType = "COMMON";
|
||||||
|
|
||||||
|
// 上传序列类型
|
||||||
|
public static final String uploadSeqType = "UPLOAD";
|
||||||
|
|
||||||
|
// 通用接口序列数
|
||||||
|
private static AtomicInteger commSeq = new AtomicInteger(1);
|
||||||
|
|
||||||
|
// 上传接口序列数
|
||||||
|
private static AtomicInteger uploadSeq = new AtomicInteger(1);
|
||||||
|
|
||||||
|
// 机器标识
|
||||||
|
private static final String machineCode = "A";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取通用序列号
|
||||||
|
*
|
||||||
|
* @return 序列值
|
||||||
|
*/
|
||||||
|
public static String getId()
|
||||||
|
{
|
||||||
|
return getId(commSeqType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认16位序列号 yyMMddHHmmss + 一位机器标识 + 3长度循环递增字符串
|
||||||
|
*
|
||||||
|
* @return 序列值
|
||||||
|
*/
|
||||||
|
public static String getId(String type)
|
||||||
|
{
|
||||||
|
AtomicInteger atomicInt = commSeq;
|
||||||
|
if (uploadSeqType.equals(type))
|
||||||
|
{
|
||||||
|
atomicInt = uploadSeq;
|
||||||
|
}
|
||||||
|
return getId(atomicInt, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用接口序列号 yyMMddHHmmss + 一位机器标识 + length长度循环递增字符串
|
||||||
|
*
|
||||||
|
* @param atomicInt 序列数
|
||||||
|
* @param length 数值长度
|
||||||
|
* @return 序列值
|
||||||
|
*/
|
||||||
|
public static String getId(AtomicInteger atomicInt, int length)
|
||||||
|
{
|
||||||
|
String result = DateUtils.dateTimeNow();
|
||||||
|
result += machineCode;
|
||||||
|
result += getSeq(atomicInt, length);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 序列循环递增字符串[1, 10 的 (length)幂次方), 用0左补齐length位数
|
||||||
|
*
|
||||||
|
* @return 序列值
|
||||||
|
*/
|
||||||
|
private synchronized static String getSeq(AtomicInteger atomicInt, int length)
|
||||||
|
{
|
||||||
|
// 先取值再+1
|
||||||
|
int value = atomicInt.getAndIncrement();
|
||||||
|
|
||||||
|
// 如果更新后值>=10 的 (length)幂次方则重置为1
|
||||||
|
int maxSeq = (int) Math.pow(10, length);
|
||||||
|
if (atomicInt.get() >= maxSeq)
|
||||||
|
{
|
||||||
|
atomicInt.set(1);
|
||||||
|
}
|
||||||
|
// 转字符串,用0左补齐
|
||||||
|
return StringUtils.padl(value, length);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
package com.jing.common.security.utils;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import com.jing.common.core.constant.SecurityConstants;
|
||||||
|
import com.jing.common.core.constant.TokenConstants;
|
||||||
|
import com.jing.common.core.context.SecurityContextHolder;
|
||||||
|
import com.jing.common.core.utils.ServletUtils;
|
||||||
|
import com.jing.common.core.utils.StringUtils;
|
||||||
|
import com.jing.system.api.model.LoginUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限获取工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class SecurityUtils
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 获取用户ID
|
||||||
|
*/
|
||||||
|
public static Long getUserId()
|
||||||
|
{
|
||||||
|
return SecurityContextHolder.getUserId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户名称
|
||||||
|
*/
|
||||||
|
public static String getUsername()
|
||||||
|
{
|
||||||
|
return SecurityContextHolder.getUserName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户key
|
||||||
|
*/
|
||||||
|
public static String getUserKey()
|
||||||
|
{
|
||||||
|
return SecurityContextHolder.getUserKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录用户信息
|
||||||
|
*/
|
||||||
|
public static LoginUser getLoginUser()
|
||||||
|
{
|
||||||
|
return SecurityContextHolder.get(SecurityConstants.LOGIN_USER, LoginUser.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取请求token
|
||||||
|
*/
|
||||||
|
public static String getToken()
|
||||||
|
{
|
||||||
|
return getToken(ServletUtils.getRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据request获取请求token
|
||||||
|
*/
|
||||||
|
public static String getToken(HttpServletRequest request)
|
||||||
|
{
|
||||||
|
// 从header获取token标识
|
||||||
|
String token = request.getHeader(TokenConstants.AUTHENTICATION);
|
||||||
|
return replaceTokenPrefix(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 裁剪token前缀
|
||||||
|
*/
|
||||||
|
public static String replaceTokenPrefix(String token)
|
||||||
|
{
|
||||||
|
// 如果前端设置了令牌前缀,则裁剪掉前缀
|
||||||
|
if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX))
|
||||||
|
{
|
||||||
|
token = token.replaceFirst(TokenConstants.PREFIX, "");
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为管理员
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static boolean isAdmin(Long userId)
|
||||||
|
{
|
||||||
|
return userId != null && 1L == userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成BCryptPasswordEncoder密码
|
||||||
|
*
|
||||||
|
* @param password 密码
|
||||||
|
* @return 加密字符串
|
||||||
|
*/
|
||||||
|
public static String encryptPassword(String password)
|
||||||
|
{
|
||||||
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
return passwordEncoder.encode(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断密码是否相同
|
||||||
|
*
|
||||||
|
* @param rawPassword 真实密码
|
||||||
|
* @param encodedPassword 加密后字符
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static boolean matchesPassword(String rawPassword, String encodedPassword)
|
||||||
|
{
|
||||||
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
return passwordEncoder.matches(rawPassword, encodedPassword);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package ${packageName}.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import ${packageName}.domain.${ClassName};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}Service接口
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @date ${datetime}
|
||||||
|
*/
|
||||||
|
public interface I${ClassName}Service
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
|
* @return ${functionName}
|
||||||
|
*/
|
||||||
|
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询${functionName}列表
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return ${functionName}集合
|
||||||
|
*/
|
||||||
|
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${functionName}
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insert${ClassName}(${ClassName} ${className});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改${functionName}
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int update${ClassName}(${ClassName} ${className});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除${functionName}信息
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
}
|
|
@ -0,0 +1,169 @@
|
||||||
|
package ${packageName}.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
||||||
|
import com.jing.common.core.utils.DateUtils;
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
#if($table.sub)
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import com.jing.common.core.utils.StringUtils;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import ${packageName}.domain.${subClassName};
|
||||||
|
#end
|
||||||
|
import ${packageName}.mapper.${ClassName}Mapper;
|
||||||
|
import ${packageName}.domain.${ClassName};
|
||||||
|
import ${packageName}.service.I${ClassName}Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${functionName}Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @date ${datetime}
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ${ClassName}Mapper ${className}Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
|
* @return ${functionName}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
||||||
|
{
|
||||||
|
return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询${functionName}列表
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return ${functionName}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
|
||||||
|
{
|
||||||
|
return ${className}Mapper.select${ClassName}List(${className});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${functionName}
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
#if($table.sub)
|
||||||
|
@Transactional
|
||||||
|
#end
|
||||||
|
@Override
|
||||||
|
public int insert${ClassName}(${ClassName} ${className})
|
||||||
|
{
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.javaField == 'createTime')
|
||||||
|
${className}.setCreateTime(DateUtils.getNowDate());
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
int rows = ${className}Mapper.insert${ClassName}(${className});
|
||||||
|
insert${subClassName}(${className});
|
||||||
|
return rows;
|
||||||
|
#else
|
||||||
|
return ${className}Mapper.insert${ClassName}(${className});
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改${functionName}
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
#if($table.sub)
|
||||||
|
@Transactional
|
||||||
|
#end
|
||||||
|
@Override
|
||||||
|
public int update${ClassName}(${ClassName} ${className})
|
||||||
|
{
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.javaField == 'updateTime')
|
||||||
|
${className}.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
|
||||||
|
insert${subClassName}(${className});
|
||||||
|
#end
|
||||||
|
return ${className}Mapper.update${ClassName}(${className});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除${functionName}
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
#if($table.sub)
|
||||||
|
@Transactional
|
||||||
|
#end
|
||||||
|
@Override
|
||||||
|
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||||
|
{
|
||||||
|
#if($table.sub)
|
||||||
|
${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
|
||||||
|
#end
|
||||||
|
return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除${functionName}信息
|
||||||
|
*
|
||||||
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
#if($table.sub)
|
||||||
|
@Transactional
|
||||||
|
#end
|
||||||
|
@Override
|
||||||
|
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
||||||
|
{
|
||||||
|
#if($table.sub)
|
||||||
|
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
|
||||||
|
#end
|
||||||
|
return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
|
||||||
|
}
|
||||||
|
#if($table.sub)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${subTable.functionName}信息
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}对象
|
||||||
|
*/
|
||||||
|
public void insert${subClassName}(${ClassName} ${className})
|
||||||
|
{
|
||||||
|
List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
|
||||||
|
${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
|
||||||
|
if (StringUtils.isNotNull(${subclassName}List))
|
||||||
|
{
|
||||||
|
List<${subClassName}> list = new ArrayList<${subClassName}>();
|
||||||
|
for (${subClassName} ${subclassName} : ${subclassName}List)
|
||||||
|
{
|
||||||
|
${subclassName}.set${subTableFkClassName}(${pkColumn.javaField});
|
||||||
|
list.add(${subclassName});
|
||||||
|
}
|
||||||
|
if (list.size() > 0)
|
||||||
|
{
|
||||||
|
${className}Mapper.batch${subClassName}(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1575803481213" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="804" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M62 511.97954521C62 263.86590869 263.90681826 62 511.97954521 62s449.97954521 201.825 449.97954521 449.97954521c0 248.19545479-201.90681826 449.97954521-449.97954521 449.97954521C263.90681826 962 62 760.175 62 511.97954521M901.98636348 511.97954521c0-215.24318174-175.00909131-390.41590869-390.00681827-390.41590869-215.03863652 0-389.96590869 175.17272695-389.96590868 390.41590869 0 215.28409131 175.00909131 390.45681826 389.96590868 390.45681826C727.01818174 902.47727305 901.98636348 727.30454521 901.98636348 511.97954521M264.17272695 430.28409131c0-5.76818174 2.12727305-11.51590869 6.64772696-15.87272696 8.71363652-8.75454521 22.88863652-8.75454521 31.725 0l209.4340913 208.22727305L721.45454521 414.53409131c8.75454521-8.71363652 22.97045479-8.71363652 31.90909132 0 8.71363652 8.75454521 8.71363652 22.88863652 0 31.60227304L511.97954521 685.74090869 270.71818174 446.01363653C266.27954521 441.77954521 264.17272695 436.05227305 264.17272695 430.28409131" p-id="805"></path></svg>
|
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1591690642331" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="561" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M178.730368 448.278738v226.23413c0 175.689587-9.325063 154.471691 187.85271199 264.615547l145.95750301 84.466147v-108.116668l-229.747921-131.091461c-17.163521-11.487396-13.51458399-7.973604-13.514584-55.004356l241.775901 137.30817 1.081167-331.242444L269.818662 676.675201l0.810875-179.743962c81.087502-44.057543 160.01267-91.493731 240.965025-135.145836v-104.738023z" fill="#33E7D8" p-id="562"></path><path d="M511.594562 361.379966l244.208526 140.551669v43.787251l-243.938234-136.49729401v77.70885501l242.992213 138.524482v148.66042l-243.262505 141.767982v108.116669l216.233338-124.334169c130.550878-71.221856 116.360565-67.572918 116.360565-224.747526v-229.747921L511.459417 257.04738zM511.864854 211.503233l333.404778 189.204171V190.420483l-95.277815-51.490564v99.061898l-142.849148-79.330605V51.625709L512.135146 0l-0.270292 211.503233z" fill="#246ADF" p-id="563"></path><path d="M178.460077 402.329154l333.404777-190.825921L512.135146 0l-95.548106 55.544939v103.116273L277.65712 237.991817v-99.061898L178.460077 190.420483v211.908671z" fill="#33E7D8" p-id="564"></path><path d="M511.189125 866.690247l-0.135146 1.351458 202.583608-113.522502-0.405437-102.845981-201.097004-116.225419-0.946021 331.242444z" fill="#246ADF" p-id="565"></path><path d="M178.460077 402.329154l23.24508301 32.705292 309.75425699-177.987066 310.700277 174.338129 23.109938-30.678105-333.404778-189.204171L178.460077 402.329154zM512.135146 535.447803l201.097004 116.225419 0.405437 102.845981-202.583608 113.522502 0.675729 47.436189 243.262505-141.76798201V625.725221L511.594562 487.200739l0.540584 48.247064z" p-id="566"></path><path d="M512.135146 535.447803l-0.675729-48.247064-200.421275 114.468523c2.027188-97.710439-11.892834-71.221856 51.490563-108.116669l148.66042-84.06071v-48.111917c-81.087502 44.057543-159.336941 91.493731-240.965026 135.145836l-0.81087499 179.743962z" fill="#FFFFFF" p-id="567"></path><path d="M511.459417 487.200739V409.491883l-148.66042 84.06071c-63.383397 36.894813-49.463376 10.406229-51.490564 108.116669z" fill="#33E7D8" p-id="568"></path><path d="M511.729708 915.477894l-0.675729-46.76046L269.683516 729.382077c0 47.030751-4.054375 43.516959 13.514584 55.004356z" fill="#FFFFFF" p-id="569"></path><path d="M511.864854 409.627029l244.07338 136.091857v-43.787251l-244.343672-140.551669 0.270292 48.247063z" p-id="570"></path></svg>
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1547360688278" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M890 120H134a70 70 0 0 0-70 70v500a70 70 0 0 0 70 70h756a70 70 0 0 0 70-70V190a70 70 0 0 0-70-70z m-10 520a40 40 0 0 1-40 40H712V448a40 40 0 0 0-80 0v232h-80V368a40 40 0 0 0-80 0v312h-80V512a40 40 0 0 0-80 0v168H184a40 40 0 0 1-40-40V240a40 40 0 0 1 40-40h656a40 40 0 0 1 40 40zM696 824H328a40 40 0 0 0 0 80h368a40 40 0 0 0 0-80z" p-id="6718"></path></svg>
|
After Width: | Height: | Size: 742 B |
|
@ -0,0 +1,138 @@
|
||||||
|
<template>
|
||||||
|
<!-- 授权用户 -->
|
||||||
|
<el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body>
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
|
||||||
|
<el-form-item label="用户名称" prop="userName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.userName"
|
||||||
|
placeholder="请输入用户名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="手机号码" prop="phonenumber">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.phonenumber"
|
||||||
|
placeholder="请输入手机号码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-row>
|
||||||
|
<el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px">
|
||||||
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
|
<el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-row>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleSelectUser">确 定</el-button>
|
||||||
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { unallocatedUserList, authUserSelectAll } from "@/api/system/role";
|
||||||
|
export default {
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
|
props: {
|
||||||
|
// 角色编号
|
||||||
|
roleId: {
|
||||||
|
type: [Number, String]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
visible: false,
|
||||||
|
// 选中数组值
|
||||||
|
userIds: [],
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 未授权用户数据
|
||||||
|
userList: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
roleId: undefined,
|
||||||
|
userName: undefined,
|
||||||
|
phonenumber: undefined
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 显示弹框
|
||||||
|
show() {
|
||||||
|
this.queryParams.roleId = this.roleId;
|
||||||
|
this.getList();
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
clickRow(row) {
|
||||||
|
this.$refs.table.toggleRowSelection(row);
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.userIds = selection.map(item => item.userId);
|
||||||
|
},
|
||||||
|
// 查询表数据
|
||||||
|
getList() {
|
||||||
|
unallocatedUserList(this.queryParams).then(res => {
|
||||||
|
this.userList = res.rows;
|
||||||
|
this.total = res.total;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 选择授权用户操作 */
|
||||||
|
handleSelectUser() {
|
||||||
|
const roleId = this.queryParams.roleId;
|
||||||
|
const userIds = this.userIds.join(",");
|
||||||
|
if (userIds == "") {
|
||||||
|
this.$modal.msgError("请选择要分配的用户");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
|
||||||
|
this.$modal.msgSuccess(res.msg);
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit("ok");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue