mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
@@ -2,7 +2,7 @@ package com.gitee.sop.adminbackend.service;
|
|||||||
|
|
||||||
import com.gitee.sop.adminbackend.BaseTest;
|
import com.gitee.sop.adminbackend.BaseTest;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
||||||
import com.gitee.sop.adminbackend.service.sys.SysAdminUserService;
|
import com.gitee.sop.adminbackend.service.sys.SysUserService;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.security.crypto.bcrypt.BCrypt;
|
import org.springframework.security.crypto.bcrypt.BCrypt;
|
||||||
@@ -16,7 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
public class PasswordTest extends BaseTest {
|
public class PasswordTest extends BaseTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
SysAdminUserService sysAdminUserService;
|
SysUserService sysAdminUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置admin密码
|
* 重置admin密码
|
||||||
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IdsDTO {
|
||||||
|
private List<Long> ids;
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatusUpdateBatchDTO extends IdsDTO {
|
||||||
|
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,25 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.jackson.convert.annotation;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.gitee.sop.adminbackend.common.jackson.convert.serde.BoolDeserializer;
|
||||||
|
import com.gitee.sop.adminbackend.common.jackson.convert.serde.BoolSerializer;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 序列化自动转换成boolean值,反序列化转换成数字
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@JacksonAnnotationsInside
|
||||||
|
@JsonSerialize(using = BoolSerializer.class)
|
||||||
|
@JsonDeserialize(using = BoolDeserializer.class)
|
||||||
|
public @interface Bool {
|
||||||
|
}
|
@@ -0,0 +1,44 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.jackson.convert.serde;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* {@literal
|
||||||
|
* 将布尔值类型转换成数字
|
||||||
|
*
|
||||||
|
* @IntBool
|
||||||
|
* private Integer isLoading;
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class BoolDeserializer extends StdDeserializer<Object> {
|
||||||
|
private static final long serialVersionUID = -4993230470571124275L;
|
||||||
|
|
||||||
|
private static final String TRUE = "true";
|
||||||
|
|
||||||
|
|
||||||
|
public BoolDeserializer() {
|
||||||
|
this(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BoolDeserializer(final Class<?> vc) {
|
||||||
|
super(vc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object deserialize(final JsonParser p, final DeserializationContext ctxt) throws IOException {
|
||||||
|
String text = p.getText();
|
||||||
|
return Objects.equals(TRUE, text) ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,38 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.jackson.convert.serde;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* {@literal
|
||||||
|
* 将数字类型转换成布尔
|
||||||
|
*
|
||||||
|
* @Bool
|
||||||
|
* private Integer isLoading; // 返回给前端: "isLoading": true/false
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class BoolSerializer extends JsonSerializer<Object> {
|
||||||
|
|
||||||
|
private static final String TRUE_VALUE = "1";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(Object value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||||
|
if (value == null) {
|
||||||
|
jsonGenerator.writeNull();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
jsonGenerator.writeBoolean(Objects.equals(TRUE_VALUE, String.valueOf(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,15 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IdsParam {
|
||||||
|
@NotEmpty(message = "id不能为空")
|
||||||
|
private List<Long> ids;
|
||||||
|
}
|
@@ -0,0 +1,18 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class StatusUpdateBatchParam extends IdsParam {
|
||||||
|
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
@@ -1,12 +1,14 @@
|
|||||||
package com.gitee.sop.adminbackend.common.req;
|
package com.gitee.sop.adminbackend.common.req;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class StatusUpdateParam extends IdParam {
|
public class StatusUpdateParam extends IdParam {
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.gitee.sop.adminbackend.common.util;
|
package com.gitee.sop.adminbackend.common.util;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.gitee.fastmybatis.core.PageInfo;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.beans.FatalBeanException;
|
import org.springframework.beans.FatalBeanException;
|
||||||
@@ -337,6 +338,21 @@ public class CopyUtil extends BeanUtils {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <R, T> PageInfo<R> copyPageInfo(PageInfo<T> srcPageInfo, Function<List<T>, List<R>> function) {
|
||||||
|
PageInfo<R> pageInfo = new PageInfo<>();
|
||||||
|
List<T> list = srcPageInfo.getList();
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
pageInfo.setList(function.apply(list));
|
||||||
|
} else {
|
||||||
|
pageInfo.setList(new ArrayList<>(0));
|
||||||
|
}
|
||||||
|
pageInfo.setPageCount(srcPageInfo.getPageCount());
|
||||||
|
pageInfo.setPageIndex(srcPageInfo.getPageIndex());
|
||||||
|
pageInfo.setPageSize(srcPageInfo.getPageSize());
|
||||||
|
pageInfo.setTotal(srcPageInfo.getTotal());
|
||||||
|
return pageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
public interface CopyConsumer<F, T> {
|
public interface CopyConsumer<F, T> {
|
||||||
void apply(F from, T to);
|
void apply(F from, T to);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,73 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.entity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.annotation.Pk;
|
||||||
|
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||||
|
import com.gitee.fastmybatis.annotation.Table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名:sys_dept
|
||||||
|
* 备注:部门表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Table(name = "sys_dept", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||||
|
@Data
|
||||||
|
public class SysDept {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,159 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.entity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.annotation.Pk;
|
||||||
|
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||||
|
import com.gitee.fastmybatis.annotation.Table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名:sys_resource
|
||||||
|
* 备注:菜单资源表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Table(name = "sys_resource", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||||
|
@Data
|
||||||
|
public class SysResource {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
|
||||||
|
*/
|
||||||
|
private Integer menuType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单名称
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由路径
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由路径
|
||||||
|
*/
|
||||||
|
private String component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer rank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由重定向
|
||||||
|
*/
|
||||||
|
private String redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由重定向
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 右侧图标
|
||||||
|
*/
|
||||||
|
private String extraIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进场动画(页面加载动画)
|
||||||
|
*/
|
||||||
|
private String enterTransition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离场动画(页面加载动画)
|
||||||
|
*/
|
||||||
|
private String leaveTransition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单激活
|
||||||
|
*/
|
||||||
|
private String activePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限标识
|
||||||
|
*/
|
||||||
|
private String auths;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链接地址(需要内嵌的`iframe`链接地址)
|
||||||
|
*/
|
||||||
|
private String frameSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载动画(内嵌的`iframe`页面是否开启首次加载动画)
|
||||||
|
*/
|
||||||
|
private Integer frameLoading;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存页面
|
||||||
|
*/
|
||||||
|
private Integer keepAlive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签页(当前菜单名称或自定义信息禁止添加到标签页)
|
||||||
|
*/
|
||||||
|
private Integer hiddenTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 固定标签页(当前菜单名称是否固定显示在标签页且不可关闭)
|
||||||
|
*/
|
||||||
|
private Integer fixedTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单(是否显示该菜单)
|
||||||
|
*/
|
||||||
|
private Integer showLink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级菜单(是否显示父级菜单
|
||||||
|
*/
|
||||||
|
private Integer showParent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@com.gitee.fastmybatis.annotation.Column(logicDelete = true)
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.entity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.annotation.Pk;
|
||||||
|
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||||
|
import com.gitee.fastmybatis.annotation.Table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名:sys_role_resource
|
||||||
|
* 备注:角色资源关联表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Table(name = "sys_role_resource", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||||
|
@Data
|
||||||
|
public class SysRoleResource {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sys_role.id
|
||||||
|
*/
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sys_resource.id
|
||||||
|
*/
|
||||||
|
private Long resourceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,98 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.entity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.annotation.Pk;
|
||||||
|
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||||
|
import com.gitee.fastmybatis.annotation.Table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名:sys_user
|
||||||
|
* 备注:系统用户表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Table(name = "sys_user", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||||
|
@Data
|
||||||
|
public class SysUser {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别,0-未知,1-男,2-女
|
||||||
|
*/
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册类型,1-系统,2-手动
|
||||||
|
*/
|
||||||
|
private String regType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.entity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.annotation.Pk;
|
||||||
|
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||||
|
import com.gitee.fastmybatis.annotation.Table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名:sys_user_dept
|
||||||
|
* 备注:用户部门关联表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Table(name = "sys_user_dept", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||||
|
@Data
|
||||||
|
public class SysUserDept {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sys_user.id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sys_dept.id
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.entity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.annotation.Pk;
|
||||||
|
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||||
|
import com.gitee.fastmybatis.annotation.Table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名:sys_user_role
|
||||||
|
* 备注:用户角色关联表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Table(name = "sys_user_role", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||||
|
@Data
|
||||||
|
public class SysUserRole {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sys_role.id
|
||||||
|
*/
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sys_user.id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.mapper;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysDept;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysDeptMapper extends BaseMapper<SysDept> {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.mapper;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysResource;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysResourceMapper extends BaseMapper<SysResource> {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.mapper;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysRoleResource;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysRoleResourceMapper extends BaseMapper<SysRoleResource> {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.mapper;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysUserDept;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysUserDeptMapper extends BaseMapper<SysUserDept> {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.mapper;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.mapper;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysUserRole;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||||
|
|
||||||
|
}
|
@@ -1,39 +0,0 @@
|
|||||||
package com.gitee.sop.adminbackend.service.sys;
|
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
|
||||||
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
|
||||||
import com.gitee.sop.adminbackend.common.config.Configs;
|
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
|
||||||
import com.gitee.sop.adminbackend.dao.mapper.SysAdminUserMapper;
|
|
||||||
import com.gitee.sop.adminbackend.common.util.GenerateUtil;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 六如
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class SysAdminUserService implements LambdaService<SysAdminUser, SysAdminUserMapper> {
|
|
||||||
|
|
||||||
|
|
||||||
public SysAdminUser getByUsername(String username) {
|
|
||||||
return this.get(SysAdminUser::getUsername, username);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDbPassword(String username, String password) {
|
|
||||||
return getDbPassword(username, password, getPasswordSalt());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDbPassword(String username) {
|
|
||||||
return this.query().eq(SysAdminUser::getUsername, username).getValue(SysAdminUser::getPassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDbPassword(String username, String password, String salt) {
|
|
||||||
return GenerateUtil.getUserPassword(username, password, salt);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getPasswordSalt() {
|
|
||||||
return Configs.getValue(ConfigKeyEnum.PASSWORD_SALT);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -0,0 +1,55 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.PageInfo;
|
||||||
|
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.fastmybatis.core.util.TreeUtil;
|
||||||
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||||
|
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysDept;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.SysDeptMapper;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysDeptDTO;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysDeptService implements LambdaService<SysDept, SysDeptMapper> {
|
||||||
|
|
||||||
|
public Long addDept(SysDept sysDept) {
|
||||||
|
long count = this.query()
|
||||||
|
.eq(SysDept::getParentId, 0)
|
||||||
|
.getCount();
|
||||||
|
if (count > 0 && Objects.equals(sysDept.getParentId(), 0L)) {
|
||||||
|
throw new BizException("只能有一个根节点");
|
||||||
|
}
|
||||||
|
this.save(sysDept);
|
||||||
|
return sysDept.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SysDeptDTO> listTree(LambdaQuery<SysDept> query) {
|
||||||
|
List<SysDept> list = this.list(query);
|
||||||
|
List<SysDeptDTO> sysDeptList = CopyUtil.copyList(list, SysDeptDTO::new);
|
||||||
|
return TreeUtil.convertTree(sysDeptList, 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
*
|
||||||
|
* @param statusUpdateDTO 修改值
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
public int updateStatus(StatusUpdateDTO statusUpdateDTO) {
|
||||||
|
return this.query()
|
||||||
|
.eq(SysDept::getId, statusUpdateDTO.getId())
|
||||||
|
.set(SysDept::getStatus, statusUpdateDTO.getStatus())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysResource;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.SysResourceMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysResourceService implements LambdaService<SysResource, SysResourceMapper> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,53 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysRoleResource;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.SysRoleResourceMapper;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysRoleResourceDTO;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysRoleResourceService implements LambdaService<SysRoleResource, SysRoleResourceMapper> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存角色菜单配置
|
||||||
|
*
|
||||||
|
* @param sysRoleResourceDTO 入参
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int saveRoleResource(SysRoleResourceDTO sysRoleResourceDTO) {
|
||||||
|
Long roleId = sysRoleResourceDTO.getRoleId();
|
||||||
|
// 删除之前的
|
||||||
|
this.deleteByColumn(SysRoleResource::getRoleId, roleId);
|
||||||
|
|
||||||
|
List<SysRoleResource> saveList = sysRoleResourceDTO.getResourceIds().stream()
|
||||||
|
.map(resourceId -> {
|
||||||
|
SysRoleResource sysRoleResource = new SysRoleResource();
|
||||||
|
sysRoleResource.setRoleId(roleId);
|
||||||
|
sysRoleResource.setResourceId(resourceId);
|
||||||
|
sysRoleResource.setAddBy(sysRoleResourceDTO.getAddBy());
|
||||||
|
sysRoleResource.setUpdateBy(sysRoleResourceDTO.getAddBy());
|
||||||
|
return sysRoleResource;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
return this.saveBatch(saveList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> listRoleResource(Long roleId) {
|
||||||
|
return this.query()
|
||||||
|
.eq(SysRoleResource::getRoleId, roleId)
|
||||||
|
.listUniqueValue(SysRoleResource::getResourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,7 +1,5 @@
|
|||||||
package com.gitee.sop.adminbackend.service.sys;
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.PageInfo;
|
|
||||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
|
||||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysRole;
|
import com.gitee.sop.adminbackend.dao.entity.SysRole;
|
||||||
@@ -15,16 +13,6 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class SysRoleService implements LambdaService<SysRole, SysRoleMapper> {
|
public class SysRoleService implements LambdaService<SysRole, SysRoleMapper> {
|
||||||
|
|
||||||
public PageInfo<SysRole> doPage(LambdaQuery<SysRole> query) {
|
|
||||||
query.orderByDesc(SysRole::getId);
|
|
||||||
PageInfo<SysRole> page = this.page(query);
|
|
||||||
|
|
||||||
// 格式转换
|
|
||||||
return page.convert(isvInfo -> {
|
|
||||||
|
|
||||||
return isvInfo;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改状态
|
* 修改状态
|
||||||
@@ -40,4 +28,5 @@ public class SysRoleService implements LambdaService<SysRole, SysRoleMapper> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,116 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysDept;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysUserDept;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.SysDeptMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.SysUserDeptMapper;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.DeptUserResultDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysDeptDTO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysUserDeptService implements LambdaService<SysUserDept, SysUserDeptMapper> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysDeptMapper sysDeptMapper;
|
||||||
|
|
||||||
|
public Map<Long, SysDeptDTO> getUserDeptId(Collection<Long> userIds) {
|
||||||
|
Map<Long, SysDept> deptIdMap = sysDeptMapper.query()
|
||||||
|
.map(SysDept::getId, Function.identity());
|
||||||
|
return this.query()
|
||||||
|
.in(SysUserDept::getUserId, userIds)
|
||||||
|
.map(SysUserDept::getUserId, sysUserDept -> {
|
||||||
|
SysDept sysDept = deptIdMap.get(sysUserDept.getDeptId());
|
||||||
|
return CopyUtil.copyBean(sysDept, SysDeptDTO::new);
|
||||||
|
}, (v1, v2) -> v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找部门及子部门下所有用户
|
||||||
|
*
|
||||||
|
* @param deptId 部门
|
||||||
|
* @return 返回空表示选中了根节点或没有选
|
||||||
|
*/
|
||||||
|
public DeptUserResultDTO listDeptUserIdsDeep(Long deptId) {
|
||||||
|
if (deptId == null) {
|
||||||
|
return new DeptUserResultDTO(false, null);
|
||||||
|
}
|
||||||
|
SysDept sysDept = sysDeptMapper.getById(deptId);
|
||||||
|
// 选中了根节点或没有选
|
||||||
|
if (sysDept == null || Objects.equals(sysDept.getParentId(), 0L)) {
|
||||||
|
return new DeptUserResultDTO(false, null);
|
||||||
|
}
|
||||||
|
List<Long> userIdsAll = new ArrayList<>();
|
||||||
|
List<Long> userIds = this.query()
|
||||||
|
.eq(SysUserDept::getDeptId, deptId)
|
||||||
|
.listUniqueValue(SysUserDept::getUserId);
|
||||||
|
|
||||||
|
appendChildren(userIdsAll, deptId);
|
||||||
|
|
||||||
|
userIdsAll.addAll(userIds);
|
||||||
|
return new DeptUserResultDTO(true, userIdsAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void appendChildren(List<Long> userIdsAll, Long deptId) {
|
||||||
|
List<Long> deptIds = sysDeptMapper.query()
|
||||||
|
.eq(SysDept::getParentId, deptId)
|
||||||
|
.listUniqueValue(SysDept::getId);
|
||||||
|
if (deptIds.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Long> userIds = this.query()
|
||||||
|
.in(SysUserDept::getDeptId, deptIds)
|
||||||
|
.listUniqueValue(SysUserDept::getUserId);
|
||||||
|
userIdsAll.addAll(userIds);
|
||||||
|
|
||||||
|
for (Long childDeptId : deptIds) {
|
||||||
|
appendChildren(userIdsAll, childDeptId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存用户部门
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param deptIds 部门id
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
public int saveUserDept(Long userId, List<Long> deptIds) {
|
||||||
|
this.query()
|
||||||
|
.eq(SysUserDept::getUserId, userId)
|
||||||
|
.delete();
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(deptIds)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SysUserDept> saveList = deptIds.stream()
|
||||||
|
.map(deptId -> {
|
||||||
|
SysUserDept sysUserDept = new SysUserDept();
|
||||||
|
sysUserDept.setUserId(userId);
|
||||||
|
sysUserDept.setDeptId(deptId);
|
||||||
|
return sysUserDept;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
return this.saveBatch(saveList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,55 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.sop.adminbackend.common.user.User;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysUserRole;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.SysUserRoleMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysUserRoleService implements LambdaService<SysUserRole, SysUserRoleMapper> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户角色
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param roleIds 角色id
|
||||||
|
* @param operator 操作人
|
||||||
|
*/
|
||||||
|
public void setUserRole(Long userId, List<Long> roleIds, User operator) {
|
||||||
|
this.query()
|
||||||
|
.eq(SysUserRole::getUserId, userId)
|
||||||
|
.delete();
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(roleIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<SysUserRole> saveList = new LinkedHashSet<>(roleIds).stream()
|
||||||
|
.map(roleId -> {
|
||||||
|
SysUserRole sysUserRole = new SysUserRole();
|
||||||
|
sysUserRole.setRoleId(roleId);
|
||||||
|
sysUserRole.setUserId(userId);
|
||||||
|
sysUserRole.setAddBy(operator.getUserId());
|
||||||
|
return sysUserRole;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
this.saveBatch(saveList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Long> listUserRoleIds(Long userId) {
|
||||||
|
return this.query()
|
||||||
|
.eq(SysUserRole::getUserId, userId)
|
||||||
|
.listUniqueValue(SysUserRole::getRoleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,149 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.PageInfo;
|
||||||
|
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.sop.adminbackend.common.config.Configs;
|
||||||
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateBatchDTO;
|
||||||
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||||
|
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.GenerateUtil;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.SysUserMapper;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.DeptUserResultDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysDeptDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysUserAddDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysUserDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysUserSearchDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysUserUpdateDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCrypt;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysUserService implements LambdaService<SysUser, SysUserMapper> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysUserDeptService sysUserDeptService;
|
||||||
|
|
||||||
|
public PageInfo<SysUserDTO> doPage(SysUserSearchDTO sysUserSearchDTO) {
|
||||||
|
LambdaQuery<SysUser> query = sysUserSearchDTO.toLambdaQuery(SysUser.class);
|
||||||
|
Long deptId = sysUserSearchDTO.getDeptId();
|
||||||
|
DeptUserResultDTO deptUserResultDTO = sysUserDeptService.listDeptUserIdsDeep(deptId);
|
||||||
|
if (deptUserResultDTO.getSelect()) {
|
||||||
|
List<Long> userIds = deptUserResultDTO.getUserIds();
|
||||||
|
// 查不到返回空
|
||||||
|
if (CollectionUtils.isEmpty(userIds)) {
|
||||||
|
return new PageInfo<>();
|
||||||
|
}
|
||||||
|
query.in(SysUser::getId, userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
query.orderByDesc(SysUser::getId);
|
||||||
|
|
||||||
|
// 格式转换
|
||||||
|
return this.pageAndConvert(query, records -> {
|
||||||
|
if (records.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
Set<Long> userIds = records.stream().map(SysUser::getId).collect(Collectors.toSet());
|
||||||
|
Map<Long, SysDeptDTO> userIdDeptMap = sysUserDeptService.getUserDeptId(userIds);
|
||||||
|
|
||||||
|
return CopyUtil.copyList(records, SysUserDTO::new, after -> {
|
||||||
|
SysDeptDTO sysDeptDTO = userIdDeptMap.get(after.getId());
|
||||||
|
after.setDept(sysDeptDTO);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long addUser(SysUserAddDTO sysUserAddDTO) {
|
||||||
|
SysUser sysUser = CopyUtil.copyBean(sysUserAddDTO, SysUser::new);
|
||||||
|
String encodedPassword = BCrypt.hashpw(sysUserAddDTO.getPassword(), BCrypt.gensalt());
|
||||||
|
sysUser.setPassword(encodedPassword);
|
||||||
|
sysUser.setRegType(RegTypeEnum.BACKEND.getValue());
|
||||||
|
this.save(sysUser);
|
||||||
|
|
||||||
|
// 添加部门
|
||||||
|
Long deptId = sysUserAddDTO.getParentId();
|
||||||
|
if (deptId != null && deptId > 0) {
|
||||||
|
sysUserDeptService.saveUserDept(sysUser.getId(), Lists.newArrayList(deptId));
|
||||||
|
}
|
||||||
|
|
||||||
|
return sysUser.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateUser(SysUserUpdateDTO sysUserUpdateDTO) {
|
||||||
|
SysUser sysUser = CopyUtil.copyBean(sysUserUpdateDTO, SysUser::new);
|
||||||
|
int cnt = this.update(sysUser);
|
||||||
|
|
||||||
|
// 添加部门
|
||||||
|
Long deptId = sysUserUpdateDTO.getParentId();
|
||||||
|
if (deptId != null && deptId > 0) {
|
||||||
|
sysUserDeptService.saveUserDept(sysUser.getId(), Lists.newArrayList(deptId));
|
||||||
|
}
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
*
|
||||||
|
* @param statusUpdateDTO 修改值
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
public int updateStatus(StatusUpdateDTO statusUpdateDTO) {
|
||||||
|
return this.query()
|
||||||
|
.eq(SysUser::getId, statusUpdateDTO.getId())
|
||||||
|
.set(SysUser::getStatus, statusUpdateDTO.getStatus())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateStatus(StatusUpdateBatchDTO statusUpdateDTO) {
|
||||||
|
return this.query()
|
||||||
|
.in(SysUser::getId, statusUpdateDTO.getIds())
|
||||||
|
.set(SysUser::getStatus, statusUpdateDTO.getStatus())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetUserPassword(Long userId, String passwordHash) {
|
||||||
|
String encodedPassword = BCrypt.hashpw(passwordHash, BCrypt.gensalt());
|
||||||
|
this.query()
|
||||||
|
.eq(SysUser::getId, userId)
|
||||||
|
.set(SysUser::getPassword, encodedPassword)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysUser getByUsername(String username) {
|
||||||
|
return this.get(SysUser::getUsername, username);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDbPassword(String username, String password) {
|
||||||
|
return getDbPassword(username, password, getPasswordSalt());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDbPassword(String username) {
|
||||||
|
return this.query().eq(SysUser::getUsername, username).getValue(SysUser::getPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDbPassword(String username, String password, String salt) {
|
||||||
|
return GenerateUtil.getUserPassword(username, password, salt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPasswordSalt() {
|
||||||
|
return Configs.getValue(ConfigKeyEnum.PASSWORD_SALT);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
package com.gitee.sop.adminbackend.service.sys;
|
package com.gitee.sop.adminbackend.service.sys;
|
||||||
|
|
||||||
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||||
import com.gitee.sop.adminbackend.dao.mapper.UpgradeMapper;
|
import com.gitee.sop.adminbackend.dao.mapper.UpgradeMapper;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
||||||
import com.gitee.sop.adminbackend.common.util.PasswordUtil;
|
import com.gitee.sop.adminbackend.common.util.PasswordUtil;
|
||||||
@@ -23,7 +23,7 @@ public class UpgradeService {
|
|||||||
private SysConfigService sysConfigService;
|
private SysConfigService sysConfigService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysAdminUserService sysAdminUserService;
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UpgradeMapper upgradeMapper;
|
private UpgradeMapper upgradeMapper;
|
||||||
@@ -45,12 +45,12 @@ public class UpgradeService {
|
|||||||
|
|
||||||
|
|
||||||
public void insertAdmin() {
|
public void insertAdmin() {
|
||||||
SysAdminUser userInfo = sysAdminUserService.getByUsername("admin");
|
SysUser userInfo = sysUserService.getByUsername("admin");
|
||||||
if (userInfo != null) {
|
if (userInfo != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String username = "admin";
|
String username = "admin";
|
||||||
String tpl = "INSERT INTO `sys_admin_user` ( `username`, `password`, `nickname`, `reg_type`) VALUES \n" +
|
String tpl = "INSERT INTO `sys_user` ( `username`, `password`, `nickname`, `reg_type`) VALUES \n" +
|
||||||
"\t('%s','%s','%s','%s');";
|
"\t('%s','%s','%s','%s');";
|
||||||
// 初始密码
|
// 初始密码
|
||||||
String defPassword = "123456";
|
String defPassword = "123456";
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DeptUserResultDTO {
|
||||||
|
|
||||||
|
private Boolean select = true;
|
||||||
|
|
||||||
|
private List<Long> userIds;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,81 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.support.TreeNode;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注:部门表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysDeptDTO implements TreeNode<SysDeptDTO, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
private List<SysDeptDTO> children;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long takeId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long takeParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysRoleResourceDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色id
|
||||||
|
*/
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源id
|
||||||
|
*/
|
||||||
|
private List<Long> resourceIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加人
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,88 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserAddDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别,0-未知,1-男,2-女
|
||||||
|
*/
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册类型,1-系统,2-手动
|
||||||
|
*/
|
||||||
|
private String regType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,98 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别,0-未知,1-男,2-女
|
||||||
|
*/
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册类型,1-系统,2-手动
|
||||||
|
*/
|
||||||
|
private String regType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门
|
||||||
|
*/
|
||||||
|
private SysDeptDTO dept;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.query.Operator;
|
||||||
|
import com.gitee.fastmybatis.core.query.annotation.Condition;
|
||||||
|
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注:角色表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class SysUserSearchDTO extends PageParam {
|
||||||
|
private static final long serialVersionUID = 7794265174728302379L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@Condition(operator = Operator.like)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@Condition(operator = Operator.like)
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
@Condition
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Condition(ignore = true)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,75 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserUpdateDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id必填")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别,0-未知,1-男,2-女
|
||||||
|
*/
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册类型,1-系统,2-手动
|
||||||
|
*/
|
||||||
|
private String regType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
}
|
@@ -1,20 +1,20 @@
|
|||||||
package com.gitee.sop.adminbackend.service.sys.login;
|
package com.gitee.sop.adminbackend.service.sys.login;
|
||||||
|
|
||||||
|
import com.gitee.sop.adminbackend.common.config.Configs;
|
||||||
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||||
import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
||||||
import com.gitee.sop.adminbackend.common.exception.BizException;
|
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||||
import com.gitee.sop.adminbackend.common.config.Configs;
|
|
||||||
import com.gitee.sop.adminbackend.common.manager.UserCacheManager;
|
import com.gitee.sop.adminbackend.common.manager.UserCacheManager;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
import com.gitee.sop.adminbackend.service.sys.SysAdminUserService;
|
import com.gitee.sop.adminbackend.common.util.GenerateUtil;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.JwtUtil;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.SysUserService;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginDTO;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginDTO;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginForm;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginForm;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginResult;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginResult;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
import com.gitee.sop.adminbackend.service.sys.login.enums.RegTypeEnum;
|
||||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
|
||||||
import com.gitee.sop.adminbackend.common.util.GenerateUtil;
|
|
||||||
import com.gitee.sop.adminbackend.common.util.JwtUtil;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
@@ -38,7 +38,7 @@ import java.util.Objects;
|
|||||||
public class LoginService {
|
public class LoginService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysAdminUserService sysAdminUserService;
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserCacheManager userCacheManager;
|
private UserCacheManager userCacheManager;
|
||||||
@@ -48,7 +48,7 @@ public class LoginService {
|
|||||||
String username = loginDTO.getUsername();
|
String username = loginDTO.getUsername();
|
||||||
String password = loginDTO.getPassword();
|
String password = loginDTO.getPassword();
|
||||||
RegTypeEnum regType = loginDTO.getRegType();
|
RegTypeEnum regType = loginDTO.getRegType();
|
||||||
SysAdminUser userInfo;
|
SysUser userInfo;
|
||||||
switch (regType) {
|
switch (regType) {
|
||||||
case FORM:
|
case FORM:
|
||||||
throw new UnsupportedOperationException("第三方登录暂未支持");
|
throw new UnsupportedOperationException("第三方登录暂未支持");
|
||||||
@@ -65,16 +65,16 @@ public class LoginService {
|
|||||||
return loginUser;
|
return loginUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoginUser buildLoginUser(SysAdminUser userInfo) {
|
private LoginUser buildLoginUser(SysUser sysUser) {
|
||||||
if (StatusEnum.of(userInfo.getStatus()) == StatusEnum.DISABLED) {
|
if (StatusEnum.of(sysUser.getStatus()) == StatusEnum.DISABLED) {
|
||||||
throw new BizException("账号已禁用,请联系管理员");
|
throw new BizException("账号已禁用,请联系管理员");
|
||||||
}
|
}
|
||||||
// 登录成功
|
// 登录成功
|
||||||
LoginUser loginUser = CopyUtil.copyBean(userInfo, LoginUser::new);
|
LoginUser loginUser = CopyUtil.copyBean(sysUser, LoginUser::new);
|
||||||
// 创建token
|
// 创建token
|
||||||
String token = this.createToken(userInfo.getId());
|
String token = this.createToken(sysUser.getId());
|
||||||
loginUser.setAccessToken(token);
|
loginUser.setAccessToken(token);
|
||||||
if ("admin".equals(userInfo.getUsername())) {
|
if ("admin".equals(sysUser.getUsername())) {
|
||||||
// ROLE
|
// ROLE
|
||||||
loginUser.setRoles(Sets.newHashSet("admin"));
|
loginUser.setRoles(Sets.newHashSet("admin"));
|
||||||
// *:*:* 表示所有权限
|
// *:*:* 表示所有权限
|
||||||
@@ -102,7 +102,7 @@ public class LoginService {
|
|||||||
return Configs.getValue(ConfigKeyEnum.JWT_SECRET);
|
return Configs.getValue(ConfigKeyEnum.JWT_SECRET);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SysAdminUser doThirdPartyLogin(ThirdPartyLoginManager thirdPartyLoginManager, String username, String password) {
|
private SysUser doThirdPartyLogin(ThirdPartyLoginManager thirdPartyLoginManager, String username, String password) {
|
||||||
LoginForm loginForm = new LoginForm();
|
LoginForm loginForm = new LoginForm();
|
||||||
loginForm.setUsername(username);
|
loginForm.setUsername(username);
|
||||||
loginForm.setPassword(password);
|
loginForm.setPassword(password);
|
||||||
@@ -114,11 +114,11 @@ public class LoginService {
|
|||||||
throw new BizException(e.getMessage());
|
throw new BizException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
SysAdminUser userInfo = sysAdminUserService.getByUsername(username);
|
SysUser userInfo = sysUserService.getByUsername(username);
|
||||||
|
|
||||||
// 用户第一次登录则插入到user_info表
|
// 用户第一次登录则插入到user_info表
|
||||||
if (userInfo == null) {
|
if (userInfo == null) {
|
||||||
userInfo = new SysAdminUser();
|
userInfo = new SysUser();
|
||||||
userInfo.setUsername(username);
|
userInfo.setUsername(username);
|
||||||
userInfo.setPassword(GenerateUtil.getUUID());
|
userInfo.setPassword(GenerateUtil.getUUID());
|
||||||
userInfo.setNickname(loginResult.getNickname());
|
userInfo.setNickname(loginResult.getNickname());
|
||||||
@@ -126,26 +126,27 @@ public class LoginService {
|
|||||||
userInfo.setStatus(StatusEnum.ENABLE.getValue());
|
userInfo.setStatus(StatusEnum.ENABLE.getValue());
|
||||||
userInfo.setRegType(loginResult.getRegTypeEnum().getValue());
|
userInfo.setRegType(loginResult.getRegTypeEnum().getValue());
|
||||||
userInfo.setEmail(loginResult.getEmail());
|
userInfo.setEmail(loginResult.getEmail());
|
||||||
sysAdminUserService.save(userInfo);
|
sysUserService.save(userInfo);
|
||||||
} else {
|
} else {
|
||||||
String email = loginResult.getEmail();
|
String email = loginResult.getEmail();
|
||||||
// 如果更改了邮箱
|
// 如果更改了邮箱
|
||||||
if (StringUtils.hasText(email) && !Objects.equals(email, userInfo.getEmail())) {
|
if (StringUtils.hasText(email) && !Objects.equals(email, userInfo.getEmail())) {
|
||||||
userInfo.setEmail(email);
|
userInfo.setEmail(email);
|
||||||
sysAdminUserService.update(userInfo);
|
sysUserService.update(userInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SysAdminUser doDatabaseLogin(String username, String password) {
|
private SysUser doDatabaseLogin(String username, String password) {
|
||||||
SysAdminUser sysAdminUser = sysAdminUserService.getByUsername(username);
|
SysUser sysUser = sysUserService.getByUsername(username);
|
||||||
Assert.notNull(sysAdminUser, () -> "用户名密码不正确");
|
Assert.notNull(sysUser, () -> "用户名密码不正确");
|
||||||
String encodedPasswordDb = sysAdminUser.getPassword();
|
String encodedPasswordDb = sysUser.getPassword();
|
||||||
// 校验
|
// 校验
|
||||||
boolean flag = BCrypt.checkpw(password, encodedPasswordDb);
|
boolean flag = BCrypt.checkpw(password, encodedPasswordDb);
|
||||||
Assert.isTrue(flag, () -> "用户名密码不正确");
|
Assert.isTrue(flag, () -> "用户名密码不正确");
|
||||||
return sysAdminUser;
|
Assert.isTrue(Objects.equals(sysUser.getStatus(), StatusEnum.ENABLE.getValue()), () -> "用户已禁用");
|
||||||
|
return sysUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,8 +2,8 @@ package com.gitee.sop.adminbackend.service.sys.login.impl;
|
|||||||
|
|
||||||
import com.gitee.sop.adminbackend.common.user.User;
|
import com.gitee.sop.adminbackend.common.user.User;
|
||||||
import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
import com.gitee.sop.adminbackend.dao.entity.SysUser;
|
||||||
import com.gitee.sop.adminbackend.service.sys.SysAdminUserService;
|
import com.gitee.sop.adminbackend.service.sys.SysUserService;
|
||||||
import com.gitee.sop.adminbackend.common.manager.UserCacheManager;
|
import com.gitee.sop.adminbackend.common.manager.UserCacheManager;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
import com.gitee.sop.adminbackend.service.sys.login.dto.LoginUser;
|
||||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
@@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class DefaultUserCacheManager implements UserCacheManager, InitializingBean {
|
public class DefaultUserCacheManager implements UserCacheManager, InitializingBean {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysAdminUserService sysAdminUserService;
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
@Value("${admin.user-cache-timeout-minutes:15}")
|
@Value("${admin.user-cache-timeout-minutes:15}")
|
||||||
private int timeoutMinutes;
|
private int timeoutMinutes;
|
||||||
@@ -70,7 +70,7 @@ public class DefaultUserCacheManager implements UserCacheManager, InitializingBe
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private User getLoginUser(long id) {
|
private User getLoginUser(long id) {
|
||||||
SysAdminUser userInfo = sysAdminUserService.getById(id);
|
SysUser userInfo = sysUserService.getById(id);
|
||||||
if (userInfo == null) {
|
if (userInfo == null) {
|
||||||
log.warn("登录用户不存在,userId:{}", id);
|
log.warn("登录用户不存在,userId:{}", id);
|
||||||
return null;
|
return null;
|
||||||
|
@@ -32,9 +32,8 @@ public class ExceptionHandlerController {
|
|||||||
log.error("报错,code:{}, msg:{}", errorCode.getCode(), errorCode.getMsg(), e);
|
log.error("报错,code:{}, msg:{}", errorCode.getCode(), errorCode.getMsg(), e);
|
||||||
return Result.err(errorCode.getCode(), errorCode.getMsg());
|
return Result.err(errorCode.getCode(), errorCode.getMsg());
|
||||||
}
|
}
|
||||||
if (e instanceof BizException) {
|
if (e instanceof BizException || e instanceof IllegalArgumentException) {
|
||||||
RuntimeException bizException = (RuntimeException) e;
|
return Result.err(e.getMessage());
|
||||||
return Result.err(bizException.getMessage());
|
|
||||||
}
|
}
|
||||||
// 处理JSR-303错误
|
// 处理JSR-303错误
|
||||||
if (e instanceof MethodArgumentNotValidException) {
|
if (e instanceof MethodArgumentNotValidException) {
|
||||||
|
@@ -1,66 +0,0 @@
|
|||||||
package com.gitee.sop.adminbackend.controller.sys;
|
|
||||||
|
|
||||||
import com.gitee.fastmybatis.core.PageInfo;
|
|
||||||
import com.gitee.fastmybatis.core.query.Query;
|
|
||||||
import com.gitee.fastmybatis.core.query.param.PageParam;
|
|
||||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysAdminUser;
|
|
||||||
import com.gitee.sop.adminbackend.service.sys.SysAdminUserService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 六如
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("sys/adminuser")
|
|
||||||
public class SysAdminUserController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysAdminUserService sysAdminUserService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*
|
|
||||||
* @param param 查询参数
|
|
||||||
* @return 返回分页结果
|
|
||||||
*/
|
|
||||||
@GetMapping("/page")
|
|
||||||
public Result<PageInfo<SysAdminUser>> page(PageParam param) {
|
|
||||||
Query query = param.toQuery();
|
|
||||||
PageInfo<SysAdminUser> pageInfo = sysAdminUserService.page(query);
|
|
||||||
return Result.ok(pageInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增记录
|
|
||||||
*
|
|
||||||
* @param sysAdminUser 表单参数
|
|
||||||
* @return 返回添加后的主键值
|
|
||||||
*/
|
|
||||||
@PostMapping("/add")
|
|
||||||
public Result<Long> add(@Validated @RequestBody SysAdminUser sysAdminUser) {
|
|
||||||
sysAdminUserService.save(sysAdminUser);
|
|
||||||
// 返回添加后的主键值
|
|
||||||
return Result.ok(sysAdminUser.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改记录
|
|
||||||
*
|
|
||||||
* @param sysAdminUser 表单数据
|
|
||||||
* @return 返回影响行数
|
|
||||||
*/
|
|
||||||
@PostMapping("/update")
|
|
||||||
public Result<Integer> update(@Validated @RequestBody SysAdminUser sysAdminUser) {
|
|
||||||
return Result.ok(sysAdminUserService.update(sysAdminUser));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@@ -0,0 +1,82 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys;
|
||||||
|
|
||||||
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||||
|
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||||
|
import com.gitee.sop.adminbackend.common.req.StatusUpdateParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysDept;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.SysDeptService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("sys/dept")
|
||||||
|
public class SysDeptController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* listAll
|
||||||
|
*
|
||||||
|
* @return 返回分页结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public Result<List<SysDept>> listAll() {
|
||||||
|
List<SysDept> sysDepts = sysDeptService.listAll();
|
||||||
|
return Result.ok(sysDepts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增记录
|
||||||
|
*
|
||||||
|
* @param sysDept 表单参数
|
||||||
|
* @return 返回添加后的主键值
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<Long> add(@Validated @RequestBody SysDept sysDept) {
|
||||||
|
Long id = sysDeptService.addDept(sysDept);
|
||||||
|
// 返回添加后的主键值
|
||||||
|
return Result.ok(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改记录
|
||||||
|
*
|
||||||
|
* @param sysDept 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Result<Integer> update(@Validated @RequestBody SysDept sysDept) {
|
||||||
|
if (Objects.equals(sysDept.getParentId(), sysDept.getId())) {
|
||||||
|
throw new BizException("父级不能选自己");
|
||||||
|
}
|
||||||
|
return Result.ok(sysDeptService.update(sysDept));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
*
|
||||||
|
* @param param 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateStatus")
|
||||||
|
public Result<Integer> updateStatus(@Validated @RequestBody StatusUpdateParam param) {
|
||||||
|
StatusUpdateDTO statusUpdateDTO = CopyUtil.copyBean(param, StatusUpdateDTO::new);
|
||||||
|
return Result.ok(sysDeptService.updateStatus(statusUpdateDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,116 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys;
|
||||||
|
|
||||||
|
import com.gitee.sop.adminbackend.common.context.UserContext;
|
||||||
|
import com.gitee.sop.adminbackend.common.req.IdParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.param.SysResourceAddParam;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.param.SysResourceUpdateParam;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.param.SysRoleResourceSaveParam;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.vo.SysResourceVO;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.SysResource;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.SysResourceService;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.SysRoleResourceService;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysRoleResourceDTO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源菜单
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("sys/resource")
|
||||||
|
public class SysResourceController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysResourceService sysResourceService;
|
||||||
|
@Autowired
|
||||||
|
private SysRoleResourceService sysRoleResourceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部资源
|
||||||
|
*
|
||||||
|
* @return 返回分页结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
public Result<List<SysResourceVO>> tree() {
|
||||||
|
List<SysResource> list = sysResourceService.listAll();
|
||||||
|
List<SysResourceVO> retList = CopyUtil.copyList(list, SysResourceVO::new);
|
||||||
|
return Result.ok(retList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增记录
|
||||||
|
*
|
||||||
|
* @param param 表单参数
|
||||||
|
* @return 返回添加后的主键值
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<Long> add(@Validated @RequestBody SysResourceAddParam param) {
|
||||||
|
SysResource sysResource = CopyUtil.copyBean(param, SysResource::new);
|
||||||
|
sysResourceService.save(sysResource);
|
||||||
|
// 返回添加后的主键值
|
||||||
|
return Result.ok(sysResource.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改记录
|
||||||
|
*
|
||||||
|
* @param param 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Result<Integer> update(@Validated @RequestBody SysResourceUpdateParam param) {
|
||||||
|
SysResource sysResource = CopyUtil.copyBean(param, SysResource::new);
|
||||||
|
return Result.ok(sysResourceService.update(sysResource));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除记录
|
||||||
|
*
|
||||||
|
* @param param 参数
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public Result<Integer> delete(@Validated @RequestBody IdParam param) {
|
||||||
|
return Result.ok(sysResourceService.deleteById(param.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存角色资源
|
||||||
|
*
|
||||||
|
* @param param 参数
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/saveRoleResource")
|
||||||
|
public Result<Integer> saveRoleResource(@Validated @RequestBody SysRoleResourceSaveParam param) {
|
||||||
|
SysRoleResourceDTO sysRoleResourceDTO = CopyUtil.copyBean(param, SysRoleResourceDTO::new);
|
||||||
|
sysRoleResourceDTO.setAddBy(UserContext.getUser().getUserId());
|
||||||
|
int cnt = sysRoleResourceService.saveRoleResource(sysRoleResourceDTO);
|
||||||
|
return Result.ok(cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色资源
|
||||||
|
*
|
||||||
|
* @param param 参数
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@GetMapping("/listRoleResource")
|
||||||
|
public Result<List<Long>> listRoleResource(@Validated IdParam param) {
|
||||||
|
List<Long> resourceIds = sysRoleResourceService.listRoleResource(param.getId());
|
||||||
|
return Result.ok(resourceIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -10,6 +10,7 @@ import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
|||||||
import com.gitee.sop.adminbackend.controller.sys.param.SysRoleParam;
|
import com.gitee.sop.adminbackend.controller.sys.param.SysRoleParam;
|
||||||
import com.gitee.sop.adminbackend.dao.entity.SysRole;
|
import com.gitee.sop.adminbackend.dao.entity.SysRole;
|
||||||
import com.gitee.sop.adminbackend.service.sys.SysRoleService;
|
import com.gitee.sop.adminbackend.service.sys.SysRoleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -17,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 六如
|
* @author 六如
|
||||||
@@ -26,7 +27,7 @@ import javax.annotation.Resource;
|
|||||||
@RequestMapping("sys/role")
|
@RequestMapping("sys/role")
|
||||||
public class SysRoleController {
|
public class SysRoleController {
|
||||||
|
|
||||||
@Resource
|
@Autowired
|
||||||
private SysRoleService sysRoleService;
|
private SysRoleService sysRoleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,10 +39,21 @@ public class SysRoleController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public Result<PageInfo<SysRole>> page(SysRoleParam param) {
|
public Result<PageInfo<SysRole>> page(SysRoleParam param) {
|
||||||
LambdaQuery<SysRole> query = param.toLambdaQuery(SysRole.class);
|
LambdaQuery<SysRole> query = param.toLambdaQuery(SysRole.class);
|
||||||
PageInfo<SysRole> pageInfo = sysRoleService.doPage(query);
|
PageInfo<SysRole> pageInfo = sysRoleService.page(query);
|
||||||
return Result.ok(pageInfo);
|
return Result.ok(pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有角色
|
||||||
|
*
|
||||||
|
* @return 返回分页结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/all")
|
||||||
|
public Result<List<SysRole>> all() {
|
||||||
|
List<SysRole> list = sysRoleService.listAll();
|
||||||
|
return Result.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增记录
|
* 新增记录
|
||||||
*
|
*
|
||||||
|
@@ -0,0 +1,120 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.PageInfo;
|
||||||
|
import com.gitee.sop.adminbackend.common.context.UserContext;
|
||||||
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateBatchDTO;
|
||||||
|
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||||
|
import com.gitee.sop.adminbackend.common.req.StatusUpdateBatchParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.req.StatusUpdateParam;
|
||||||
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.param.RestPasswordParam;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.param.SysUserAddParam;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.param.SysUserParam;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.param.SysUserUpdateParam;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.vo.SysUserVO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.SysUserService;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysUserAddDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysUserDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysUserSearchDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.dto.SysUserUpdateDTO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("sys/user")
|
||||||
|
public class SysUserController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 返回分页结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/page")
|
||||||
|
public Result<PageInfo<SysUserVO>> page(SysUserParam param) {
|
||||||
|
SysUserSearchDTO sysUserSearchDTO = CopyUtil.copyBean(param, SysUserSearchDTO::new);
|
||||||
|
PageInfo<SysUserDTO> pageInfo = sysUserService.doPage(sysUserSearchDTO);
|
||||||
|
PageInfo<SysUserVO> ret = CopyUtil.copyPageInfo(pageInfo, records -> CopyUtil.deepCopyList(records, SysUserVO.class));
|
||||||
|
return Result.ok(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增记录
|
||||||
|
*
|
||||||
|
* @param param 表单参数
|
||||||
|
* @return 返回添加后的主键值
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Result<Long> add(@Validated @RequestBody SysUserAddParam param) {
|
||||||
|
SysUserAddDTO sysUser = CopyUtil.copyBean(param, SysUserAddDTO::new);
|
||||||
|
sysUser.setUpdateBy(UserContext.getUser().getUserId());
|
||||||
|
Long id = sysUserService.addUser(sysUser);
|
||||||
|
// 返回添加后的主键值
|
||||||
|
return Result.ok(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改记录
|
||||||
|
*
|
||||||
|
* @param param 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/update")
|
||||||
|
public Result<Integer> update(@Validated @RequestBody SysUserUpdateParam param) {
|
||||||
|
SysUserUpdateDTO sysUser = CopyUtil.copyBean(param, SysUserUpdateDTO::new);
|
||||||
|
sysUser.setUpdateBy(UserContext.getUser().getUserId());
|
||||||
|
int cnt = sysUserService.updateUser(sysUser);
|
||||||
|
return Result.ok(cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
*
|
||||||
|
* @param param 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateStatus")
|
||||||
|
public Result<Integer> updateStatus(@Validated @RequestBody StatusUpdateParam param) {
|
||||||
|
StatusUpdateDTO statusUpdateDTO = CopyUtil.copyBean(param, StatusUpdateDTO::new);
|
||||||
|
return Result.ok(sysUserService.updateStatus(statusUpdateDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态批量
|
||||||
|
*
|
||||||
|
* @param param 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateStatusBatch")
|
||||||
|
public Result<Integer> updateStatus(@Validated @RequestBody StatusUpdateBatchParam param) {
|
||||||
|
StatusUpdateBatchDTO statusUpdateBatchDTO = CopyUtil.copyBean(param, StatusUpdateBatchDTO::new);
|
||||||
|
return Result.ok(sysUserService.updateStatus(statusUpdateBatchDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置用户密码
|
||||||
|
*
|
||||||
|
* @param param 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/resetPassword")
|
||||||
|
public Result<Integer> resetPassword(@Validated @RequestBody RestPasswordParam param) {
|
||||||
|
sysUserService.resetUserPassword(param.getUserId(), param.getPasswordHash());
|
||||||
|
return Result.ok(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,51 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys;
|
||||||
|
|
||||||
|
import com.gitee.sop.adminbackend.common.context.UserContext;
|
||||||
|
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||||
|
import com.gitee.sop.adminbackend.controller.sys.param.SysUserRoleSettingParam;
|
||||||
|
import com.gitee.sop.adminbackend.service.sys.SysUserRoleService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("sys/userrole")
|
||||||
|
public class SysUserRoleController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysUserRoleService sysUserRoleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户角色id
|
||||||
|
*
|
||||||
|
* @return 返回角色id
|
||||||
|
*/
|
||||||
|
@GetMapping("/getUserRoleIds")
|
||||||
|
public Result<List<Long>> getUserRoleIds(Long userId) {
|
||||||
|
List<Long> roleIds = sysUserRoleService.listUserRoleIds(userId);
|
||||||
|
return Result.ok(roleIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户角色
|
||||||
|
*
|
||||||
|
* @param param 表单数据
|
||||||
|
* @return 返回影响行数
|
||||||
|
*/
|
||||||
|
@PostMapping("/setUserRole")
|
||||||
|
public Result<Integer> setUserRole(@Validated @RequestBody SysUserRoleSettingParam param) {
|
||||||
|
sysUserRoleService.setUserRole(param.getUserId(), param.getRoleIds(), UserContext.getUser());
|
||||||
|
return Result.ok(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,19 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RestPasswordParam {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String passwordHash;
|
||||||
|
}
|
@@ -0,0 +1,31 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.query.Operator;
|
||||||
|
import com.gitee.fastmybatis.core.query.annotation.Condition;
|
||||||
|
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注:部门表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class SysDeptParam extends PageParam {
|
||||||
|
private static final long serialVersionUID = 7104037961585738100L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
@Condition(operator = Operator.like)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
@Condition
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,160 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.gitee.sop.adminbackend.common.jackson.convert.annotation.Bool;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysResourceAddParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Integer menuType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单名称
|
||||||
|
*/
|
||||||
|
@NotBlank
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由名称
|
||||||
|
*/
|
||||||
|
@NotBlank
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由路径
|
||||||
|
*/
|
||||||
|
@NotBlank
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由路径
|
||||||
|
*/
|
||||||
|
private String component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer rank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由重定向
|
||||||
|
*/
|
||||||
|
private String redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由重定向
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 右侧图标
|
||||||
|
*/
|
||||||
|
private String extraIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进场动画(页面加载动画)
|
||||||
|
*/
|
||||||
|
private String enterTransition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离场动画(页面加载动画)
|
||||||
|
*/
|
||||||
|
private String leaveTransition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单激活
|
||||||
|
*/
|
||||||
|
private String activePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限标识
|
||||||
|
*/
|
||||||
|
private String auths;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链接地址(需要内嵌的`iframe`链接地址)
|
||||||
|
*/
|
||||||
|
private String frameSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载动画(内嵌的`iframe`页面是否开启首次加载动画)
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer frameLoading;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存页面
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer keepAlive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签页(当前菜单名称或自定义信息禁止添加到标签页)
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer hiddenTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 固定标签页(当前菜单名称是否固定显示在标签页且不可关闭)
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer fixedTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单(是否显示该菜单)
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer showLink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级菜单(是否显示父级菜单
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer showParent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,19 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class SysResourceUpdateParam extends SysResourceAddParam {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id必填")
|
||||||
|
private Long id;
|
||||||
|
}
|
@@ -0,0 +1,27 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysRoleResourceSaveParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色id
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源id
|
||||||
|
*/
|
||||||
|
@NotEmpty
|
||||||
|
private List<Long> resourceIds;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,96 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserAddParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别,0-未知,1-男,2-女
|
||||||
|
*/
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册类型,1-系统,2-手动
|
||||||
|
*/
|
||||||
|
private String regType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "请选择部门")
|
||||||
|
@Min(value = 1, message = "请选择部门")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.query.Operator;
|
||||||
|
import com.gitee.fastmybatis.core.query.annotation.Condition;
|
||||||
|
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注:系统用户表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class SysUserParam extends PageParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@Condition(operator = Operator.like)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@Condition(operator = Operator.like)
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
@Condition
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Condition(ignore = true)
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserRoleSettingParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sys_role.id
|
||||||
|
*/
|
||||||
|
private List<Long> roleIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sys_user.id
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class SysUserUpdateParam extends SysUserAddParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id必填")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,71 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名:sys_dept
|
||||||
|
* 备注:部门表
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysDeptVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
private List<SysDeptVO> children;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,163 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.vo;
|
||||||
|
|
||||||
|
import com.gitee.sop.adminbackend.common.jackson.convert.annotation.Bool;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysResourceVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Integer menuType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单名称
|
||||||
|
*/
|
||||||
|
@NotBlank
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由名称
|
||||||
|
*/
|
||||||
|
@NotBlank
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由路径
|
||||||
|
*/
|
||||||
|
@NotBlank
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由路径
|
||||||
|
*/
|
||||||
|
private String component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer rank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由重定向
|
||||||
|
*/
|
||||||
|
private String redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由重定向
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 右侧图标
|
||||||
|
*/
|
||||||
|
private String extraIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进场动画(页面加载动画)
|
||||||
|
*/
|
||||||
|
private String enterTransition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离场动画(页面加载动画)
|
||||||
|
*/
|
||||||
|
private String leaveTransition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单激活
|
||||||
|
*/
|
||||||
|
private String activePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限标识
|
||||||
|
*/
|
||||||
|
private String auths;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链接地址(需要内嵌的`iframe`链接地址)
|
||||||
|
*/
|
||||||
|
private String frameSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载动画(内嵌的`iframe`页面是否开启首次加载动画)
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer frameLoading;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存页面
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer keepAlive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签页(当前菜单名称或自定义信息禁止添加到标签页)
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer hiddenTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 固定标签页(当前菜单名称是否固定显示在标签页且不可关闭)
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer fixedTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单(是否显示该菜单)
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer showLink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级菜单(是否显示父级菜单
|
||||||
|
*/
|
||||||
|
@Bool
|
||||||
|
private Integer showParent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,93 @@
|
|||||||
|
package com.gitee.sop.adminbackend.controller.sys.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysUserVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别,0-未知,1-男,2-女
|
||||||
|
*/
|
||||||
|
private Integer gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态,1:启用,2:禁用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册类型,1-系统,2-手动
|
||||||
|
*/
|
||||||
|
private String regType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门
|
||||||
|
*/
|
||||||
|
private SysDeptVO dept;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -12,8 +12,8 @@ const apiRouters = [
|
|||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/serve/api/index",
|
path: "/serve/api",
|
||||||
name: "ApiManage",
|
name: "ServeApi",
|
||||||
meta: {
|
meta: {
|
||||||
title: "接口管理",
|
title: "接口管理",
|
||||||
roles: ["admin"]
|
roles: ["admin"]
|
||||||
@@ -56,8 +56,8 @@ const apiRouters = [
|
|||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/isv/list/index",
|
path: "/isv/list",
|
||||||
name: "IsvManage",
|
name: "IsvList",
|
||||||
meta: {
|
meta: {
|
||||||
title: "ISV列表",
|
title: "ISV列表",
|
||||||
roles: ["admin"]
|
roles: ["admin"]
|
||||||
@@ -65,7 +65,7 @@ const apiRouters = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/isv/perm/permGroup",
|
path: "/isv/perm/permGroup",
|
||||||
name: "PermGroup",
|
name: "IsvPermPermGroup",
|
||||||
meta: {
|
meta: {
|
||||||
title: "分组管理",
|
title: "分组管理",
|
||||||
roles: ["admin"]
|
roles: ["admin"]
|
||||||
|
@@ -3,10 +3,10 @@ import type { PageResult, Result } from "@/model";
|
|||||||
|
|
||||||
// 后端请求接口
|
// 后端请求接口
|
||||||
const apiUrl: any = createUrl({
|
const apiUrl: any = createUrl({
|
||||||
page: "/sys/adminuser/page",
|
page: "/sys/user/page",
|
||||||
add: "/sys/adminuser/add",
|
add: "/sys/user/add",
|
||||||
update: "/sys/adminuser/update",
|
update: "/sys/user/update",
|
||||||
del: "/sys/adminuser/delete"
|
del: "/sys/user/delete"
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -20,18 +20,66 @@ type ResultTable = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** 获取系统管理-用户管理列表 */
|
/** 获取系统管理-用户管理列表 */
|
||||||
export const getUserList = (data?: object) => {
|
export const getUserList = (params?: object) => {
|
||||||
return http.request<ResultTable>("post", "/user", { data });
|
return http.request<ResultTable>("get", baseUrl("sys/user/page"), { params });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-用户管理-添加 */
|
||||||
|
export const addUser = (data?: object) => {
|
||||||
|
return http.request<ResultTable>("post", baseUrl("sys/user/add"), {
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-用户管理-修改 */
|
||||||
|
export const updateUser = (data?: object) => {
|
||||||
|
return http.request<ResultTable>("post", baseUrl("sys/user/update"), {
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-用户管理-修改状态 */
|
||||||
|
export const updateUserStatus = (data?: object) => {
|
||||||
|
return http.request<ResultTable>("post", baseUrl("sys/user/updateStatus"), {
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-用户管理-重置密码 */
|
||||||
|
export const resetPassword = (data?: object) => {
|
||||||
|
return http.request<ResultTable>("post", baseUrl("sys/user/resetPassword"), {
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-用户管理-批量修改状态 */
|
||||||
|
export const updateStatusBatch = (data?: object) => {
|
||||||
|
return http.request<ResultTable>(
|
||||||
|
"post",
|
||||||
|
baseUrl("sys/user/updateStatusBatch"),
|
||||||
|
{ data }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 系统管理-用户管理-根据userId,获取对应角色id列表(userId:用户id) */
|
||||||
|
export const getRoleIds = (params?: object) => {
|
||||||
|
return http.request<Result>("get", baseUrl("sys/userrole/getUserRoleIds"), {
|
||||||
|
params
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-用户管理-设置用户角色 */
|
||||||
|
export const setUserRole = (data?: object) => {
|
||||||
|
return http.request<ResultTable>(
|
||||||
|
"post",
|
||||||
|
baseUrl("sys/userrole/setUserRole"),
|
||||||
|
{ data }
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 系统管理-用户管理-获取所有角色列表 */
|
/** 系统管理-用户管理-获取所有角色列表 */
|
||||||
export const getAllRoleList = () => {
|
export const getAllRoleList = () => {
|
||||||
return http.request<Result>("get", "/list-all-role");
|
return http.request<Result>("get", baseUrl("sys/role/all"));
|
||||||
};
|
|
||||||
|
|
||||||
/** 系统管理-用户管理-根据userId,获取对应角色id列表(userId:用户id) */
|
|
||||||
export const getRoleIds = (data?: object) => {
|
|
||||||
return http.request<Result>("post", "/list-role-ids", { data });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 获取系统管理-角色管理列表 */
|
/** 获取系统管理-角色管理列表 */
|
||||||
@@ -39,22 +87,26 @@ export const getRoleList = (params?: object) => {
|
|||||||
return http.request<ResultTable>("get", baseUrl("sys/role/page"), { params });
|
return http.request<ResultTable>("get", baseUrl("sys/role/page"), { params });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 添加角色 */
|
||||||
export const addRole = (data?: object) => {
|
export const addRole = (data?: object) => {
|
||||||
return http.request<ResultTable>("post", baseUrl("sys/role/add"), { data });
|
return http.request<ResultTable>("post", baseUrl("sys/role/add"), { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 删除角色状态 */
|
||||||
export const updateRoleStatus = (data?: object) => {
|
export const updateRoleStatus = (data?: object) => {
|
||||||
return http.request<ResultTable>("post", baseUrl("sys/role/updateStatus"), {
|
return http.request<ResultTable>("post", baseUrl("sys/role/updateStatus"), {
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 修改角色 */
|
||||||
export const updateRole = (data?: object) => {
|
export const updateRole = (data?: object) => {
|
||||||
return http.request<ResultTable>("post", baseUrl("sys/role/update"), {
|
return http.request<ResultTable>("post", baseUrl("sys/role/update"), {
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 删除角色 */
|
||||||
export const delRole = (data?: object) => {
|
export const delRole = (data?: object) => {
|
||||||
return http.request<ResultTable>("post", baseUrl("sys/role/delete"), {
|
return http.request<ResultTable>("post", baseUrl("sys/role/delete"), {
|
||||||
data
|
data
|
||||||
@@ -63,12 +115,48 @@ export const delRole = (data?: object) => {
|
|||||||
|
|
||||||
/** 获取系统管理-菜单管理列表 */
|
/** 获取系统管理-菜单管理列表 */
|
||||||
export const getMenuList = (data?: object) => {
|
export const getMenuList = (data?: object) => {
|
||||||
return http.request<Result>("post", "/menu", { data });
|
return http.request<Result>("get", baseUrl("sys/resource/listAll"), {
|
||||||
|
data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-菜单管理-添加 */
|
||||||
|
export const addMenu = (data?: object) => {
|
||||||
|
return http.request<Result>("post", baseUrl("sys/resource/add"), { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-菜单管理-修改 */
|
||||||
|
export const updateMenu = (data?: object) => {
|
||||||
|
return http.request<Result>("post", baseUrl("sys/resource/update"), { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-菜单管理-删除 */
|
||||||
|
export const deleteMenu = (data?: object) => {
|
||||||
|
return http.request<Result>("post", baseUrl("sys/resource/delete"), { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 系统管理-角色管理-保存角色菜单 */
|
||||||
|
export const saveRoleMenu = (data?: object) => {
|
||||||
|
return http.request<Result>(
|
||||||
|
"post",
|
||||||
|
baseUrl("sys/resource/saveRoleResource"),
|
||||||
|
{ data }
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 获取系统管理-部门管理列表 */
|
/** 获取系统管理-部门管理列表 */
|
||||||
export const getDeptList = (data?: object) => {
|
export const getDeptList = (params?: object) => {
|
||||||
return http.request<Result>("post", "/dept", { data });
|
return http.request<Result>("get", baseUrl("sys/dept/listAll"), { params });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-添加部门 */
|
||||||
|
export const addDept = (data?: object) => {
|
||||||
|
return http.request<Result>("post", baseUrl("sys/dept/add"), { data });
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 获取系统管理-修改部门 */
|
||||||
|
export const updateDept = (data?: object) => {
|
||||||
|
return http.request<Result>("post", baseUrl("sys/dept/update"), { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 获取系统监控-在线用户列表 */
|
/** 获取系统监控-在线用户列表 */
|
||||||
@@ -97,11 +185,13 @@ export const getSystemLogsDetail = (data?: object) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** 获取角色管理-权限-菜单权限 */
|
/** 获取角色管理-权限-菜单权限 */
|
||||||
export const getRoleMenu = (data?: object) => {
|
export const getRoleMenu = () => {
|
||||||
return http.request<Result>("post", "/role-menu", { data });
|
return http.request<Result>("get", baseUrl("sys/resource/listAll"), {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 获取角色管理-权限-菜单权限-根据角色 id 查对应菜单 */
|
/** 获取角色管理-权限-菜单权限-根据角色 id 查对应菜单 */
|
||||||
export const getRoleMenuIds = (data?: object) => {
|
export const getRoleMenuIds = (params?: object) => {
|
||||||
return http.request<Result>("post", "/role-menu-ids", { data });
|
return http.request<Result>("get", baseUrl("sys/resource/listRoleResource"), {
|
||||||
|
params
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
@@ -186,11 +186,17 @@ class PureHttp {
|
|||||||
if (response.code && response.code !== "0") {
|
if (response.code && response.code !== "0") {
|
||||||
const msg = response.msg || "后台出错,请查看日志";
|
const msg = response.msg || "后台出错,请查看日志";
|
||||||
ElMessage.error(msg);
|
ElMessage.error(msg);
|
||||||
|
reject(response);
|
||||||
} else {
|
} else {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
if (error) {
|
||||||
|
const msg = error?.message || "后台出错,请查看日志";
|
||||||
|
ElMessage.error(msg);
|
||||||
|
}
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { computed, ref } from "vue";
|
import { computed, onMounted, ref } from "vue";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import { api } from "@/api/doc";
|
import { api } from "@/api/doc";
|
||||||
import {
|
import {
|
||||||
@@ -8,44 +8,45 @@ import {
|
|||||||
} from "plus-pro-components";
|
} from "plus-pro-components";
|
||||||
import { YesOrNoEnum } from "@/model/enums";
|
import { YesOrNoEnum } from "@/model/enums";
|
||||||
|
|
||||||
export const tabsData = ref<Array<any>>([
|
export function useDocList() {
|
||||||
|
const tabsData = ref<Array<any>>([
|
||||||
{
|
{
|
||||||
id: "",
|
id: "",
|
||||||
appName: ""
|
appName: ""
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const activeName = ref(0);
|
const activeName = ref(0);
|
||||||
const docAppId = ref(0);
|
const docAppId = ref(0);
|
||||||
export const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
// 表格对象
|
// 表格对象
|
||||||
export const { tableData, buttons: actionButtons } = useTable<any[]>();
|
const { tableData, buttons: actionButtons } = useTable<any[]>();
|
||||||
|
|
||||||
export const filterText = ref("");
|
const filterText = ref("");
|
||||||
|
|
||||||
export const tableRows = computed(() => {
|
const tableRows = computed(() => {
|
||||||
let search = filterText.value;
|
let search = filterText.value;
|
||||||
if (!search) {
|
if (!search) {
|
||||||
return tableData.value;
|
return tableData.value;
|
||||||
}
|
}
|
||||||
search = search.toLowerCase();
|
search = search.toLowerCase();
|
||||||
return searchRow(search, tableData.value, searchContent, isFolder);
|
return searchRow(search, tableData.value, searchContent, isFolder);
|
||||||
});
|
});
|
||||||
|
|
||||||
const isFolder = row => {
|
const isFolder = row => {
|
||||||
return row.isFolder === 1;
|
return row.isFolder === 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchContent = (searchText, row) => {
|
const searchContent = (searchText, row) => {
|
||||||
return (
|
return (
|
||||||
(row.docName && row.docName.toLowerCase().indexOf(searchText) > -1) ||
|
(row.docName && row.docName.toLowerCase().indexOf(searchText) > -1) ||
|
||||||
(row.docTitle && row.docTitle.toLowerCase().indexOf(searchText) > -1)
|
(row.docTitle && row.docTitle.toLowerCase().indexOf(searchText) > -1)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表格字段定义
|
// 表格字段定义
|
||||||
export const tableColumns: PlusColumn[] = [
|
const tableColumns: PlusColumn[] = [
|
||||||
{
|
{
|
||||||
label: "文档标题",
|
label: "文档标题",
|
||||||
prop: "docTitle"
|
prop: "docTitle"
|
||||||
@@ -102,9 +103,9 @@ export const tableColumns: PlusColumn[] = [
|
|||||||
label: "修改时间",
|
label: "修改时间",
|
||||||
prop: "updateTime"
|
prop: "updateTime"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
// 表格按钮定义
|
// 表格按钮定义
|
||||||
actionButtons.value = [
|
actionButtons.value = [
|
||||||
{
|
{
|
||||||
text: "发布",
|
text: "发布",
|
||||||
confirm: {
|
confirm: {
|
||||||
@@ -211,19 +212,19 @@ actionButtons.value = [
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
// 点击查询按钮
|
// 点击查询按钮
|
||||||
export const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 查询
|
// 查询
|
||||||
const search = async () => {
|
const search = async () => {
|
||||||
loadContent(docAppId.value);
|
loadContent(docAppId.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function handleSyncApi() {
|
function handleSyncApi() {
|
||||||
ElMessageBox.confirm("确定要同步远程接口吗?", "提示", {
|
ElMessageBox.confirm("确定要同步远程接口吗?", "提示", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
@@ -243,19 +244,19 @@ export function handleSyncApi() {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const handleClick = data => {
|
const handleClick = data => {
|
||||||
const id = data.props.name;
|
const id = data.props.name;
|
||||||
activeTab(id);
|
activeTab(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const activeTab = id => {
|
const activeTab = id => {
|
||||||
docAppId.value = id;
|
docAppId.value = id;
|
||||||
loadContent(id);
|
loadContent(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const handleAddApp = () => {
|
const handleAddApp = () => {
|
||||||
ElMessageBox.prompt("请输入Torna应用token", "添加应用", {
|
ElMessageBox.prompt("请输入Torna应用token", "添加应用", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
@@ -272,9 +273,9 @@ export const handleAddApp = () => {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadTabs = docAppId => {
|
const loadTabs = docAppId => {
|
||||||
api.listApp().then(resp => {
|
api.listApp().then(resp => {
|
||||||
tabsData.value = resp.data;
|
tabsData.value = resp.data;
|
||||||
const length = tabsData.value.length;
|
const length = tabsData.value.length;
|
||||||
@@ -293,9 +294,9 @@ const loadTabs = docAppId => {
|
|||||||
activeTab(targetId);
|
activeTab(targetId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchRow = (search, rows, searchHandler, folderHandler) => {
|
const searchRow = (search, rows, searchHandler, folderHandler) => {
|
||||||
if (!folderHandler) {
|
if (!folderHandler) {
|
||||||
folderHandler = isFolder;
|
folderHandler = isFolder;
|
||||||
}
|
}
|
||||||
@@ -329,15 +330,32 @@ const searchRow = (search, rows, searchHandler, folderHandler) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadContent = id => {
|
const loadContent = id => {
|
||||||
const data = {
|
const data = {
|
||||||
docAppId: id
|
docAppId: id
|
||||||
};
|
};
|
||||||
api.listDocTree(data).then(resp => {
|
api.listDocTree(data).then(resp => {
|
||||||
tableData.value = resp.data;
|
tableData.value = resp.data;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
loadTabs(0);
|
onMounted(() => {
|
||||||
|
loadTabs(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
activeName,
|
||||||
|
handleClick,
|
||||||
|
handleAddApp,
|
||||||
|
handleSyncApi,
|
||||||
|
tabsData,
|
||||||
|
actionButtons,
|
||||||
|
tableColumns,
|
||||||
|
tableRows,
|
||||||
|
filterText,
|
||||||
|
loading,
|
||||||
|
handleSearch
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@@ -1,5 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import { useDocList } from "./index";
|
||||||
|
import { Search } from "@element-plus/icons-vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "DocList"
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
activeName,
|
activeName,
|
||||||
handleClick,
|
handleClick,
|
||||||
handleAddApp,
|
handleAddApp,
|
||||||
@@ -11,8 +17,7 @@ import {
|
|||||||
filterText,
|
filterText,
|
||||||
loading,
|
loading,
|
||||||
handleSearch
|
handleSearch
|
||||||
} from "./index";
|
} = useDocList();
|
||||||
import { Search } from "@element-plus/icons-vue";
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<el-card v-loading="loading" shadow="never">
|
<el-card v-loading="loading" shadow="never">
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { state, rules, columns, handleSubmit } from "./index";
|
import { state, rules, columns, handleSubmit } from "./index";
|
||||||
|
defineOptions({
|
||||||
|
name: "DocSetting"
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@@ -41,6 +41,9 @@ import {
|
|||||||
handleUpdateGroup,
|
handleUpdateGroup,
|
||||||
settingGroupFormData
|
settingGroupFormData
|
||||||
} from "@/views/isv/list/isvGroup";
|
} from "@/views/isv/list/isvGroup";
|
||||||
|
defineOptions({
|
||||||
|
name: "IsvList"
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
|
@@ -17,6 +17,9 @@ import {
|
|||||||
tableData
|
tableData
|
||||||
} from "./permGroup";
|
} from "./permGroup";
|
||||||
import PermGroupApi from "./permGroupApi.vue";
|
import PermGroupApi from "./permGroupApi.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "IsvPermPermGroup"
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
|
@@ -12,6 +12,9 @@ import {
|
|||||||
} from "./permGroupApi";
|
} from "./permGroupApi";
|
||||||
import { ApiSelect } from "@/components/ApiSelect/index";
|
import { ApiSelect } from "@/components/ApiSelect/index";
|
||||||
import { actionButtons } from "./permGroupApi";
|
import { actionButtons } from "./permGroupApi";
|
||||||
|
defineOptions({
|
||||||
|
name: "IsvPermPermGroupApi"
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@@ -66,6 +66,9 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||||||
message(t("login.pureLoginFail"), { type: "error" });
|
message(t("login.pureLoginFail"), { type: "error" });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
loading.value = false;
|
||||||
|
})
|
||||||
.finally(() => (loading.value = false));
|
.finally(() => (loading.value = false));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -18,6 +18,9 @@ import {
|
|||||||
tableData,
|
tableData,
|
||||||
total
|
total
|
||||||
} from "./index";
|
} from "./index";
|
||||||
|
defineOptions({
|
||||||
|
name: "ServeApi"
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
|
@@ -7,6 +7,7 @@ import { usePublicHooks } from "../hooks";
|
|||||||
|
|
||||||
const props = withDefaults(defineProps<FormProps>(), {
|
const props = withDefaults(defineProps<FormProps>(), {
|
||||||
formInline: () => ({
|
formInline: () => ({
|
||||||
|
id: 0,
|
||||||
higherDeptOptions: [],
|
higherDeptOptions: [],
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
name: "",
|
name: "",
|
||||||
@@ -71,34 +72,6 @@ defineExpose({ getRef });
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</re-col>
|
</re-col>
|
||||||
<re-col :value="12" :xs="24" :sm="24">
|
|
||||||
<el-form-item label="部门负责人">
|
|
||||||
<el-input
|
|
||||||
v-model="newFormInline.principal"
|
|
||||||
clearable
|
|
||||||
placeholder="请输入部门负责人"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</re-col>
|
|
||||||
|
|
||||||
<re-col :value="12" :xs="24" :sm="24">
|
|
||||||
<el-form-item label="手机号" prop="phone">
|
|
||||||
<el-input
|
|
||||||
v-model="newFormInline.phone"
|
|
||||||
clearable
|
|
||||||
placeholder="请输入手机号"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</re-col>
|
|
||||||
<re-col :value="12" :xs="24" :sm="24">
|
|
||||||
<el-form-item label="邮箱" prop="email">
|
|
||||||
<el-input
|
|
||||||
v-model="newFormInline.email"
|
|
||||||
clearable
|
|
||||||
placeholder="请输入邮箱"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</re-col>
|
|
||||||
|
|
||||||
<re-col :value="12" :xs="24" :sm="24">
|
<re-col :value="12" :xs="24" :sm="24">
|
||||||
<el-form-item label="排序">
|
<el-form-item label="排序">
|
||||||
|
@@ -76,7 +76,7 @@ function onFullscreen() {
|
|||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<PureTableBar
|
<PureTableBar
|
||||||
title="部门管理(仅演示,操作后不生效)"
|
title=""
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:tableRef="tableRef?.getTableRef()"
|
:tableRef="tableRef?.getTableRef()"
|
||||||
@refresh="onSearch"
|
@refresh="onSearch"
|
||||||
|
@@ -2,7 +2,7 @@ import dayjs from "dayjs";
|
|||||||
import editForm from "../form.vue";
|
import editForm from "../form.vue";
|
||||||
import { handleTree } from "@/utils/tree";
|
import { handleTree } from "@/utils/tree";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import { getDeptList } from "@/api/system";
|
import { addDept, updateDept, getDeptList } from "@/api/system";
|
||||||
import { usePublicHooks } from "../../hooks";
|
import { usePublicHooks } from "../../hooks";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
import { reactive, ref, onMounted, h } from "vue";
|
import { reactive, ref, onMounted, h } from "vue";
|
||||||
@@ -95,7 +95,7 @@ export function useDept() {
|
|||||||
if (!treeList || !treeList.length) return;
|
if (!treeList || !treeList.length) return;
|
||||||
const newTreeList = [];
|
const newTreeList = [];
|
||||||
for (let i = 0; i < treeList.length; i++) {
|
for (let i = 0; i < treeList.length; i++) {
|
||||||
treeList[i].disabled = treeList[i].status === 0 ? true : false;
|
treeList[i].disabled = treeList[i].status === 0;
|
||||||
formatHigherDeptOptions(treeList[i].children);
|
formatHigherDeptOptions(treeList[i].children);
|
||||||
newTreeList.push(treeList[i]);
|
newTreeList.push(treeList[i]);
|
||||||
}
|
}
|
||||||
@@ -107,6 +107,7 @@ export function useDept() {
|
|||||||
title: `${title}部门`,
|
title: `${title}部门`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
|
id: row?.id ?? 0,
|
||||||
higherDeptOptions: formatHigherDeptOptions(cloneDeep(dataList.value)),
|
higherDeptOptions: formatHigherDeptOptions(cloneDeep(dataList.value)),
|
||||||
parentId: row?.parentId ?? 0,
|
parentId: row?.parentId ?? 0,
|
||||||
name: row?.name ?? "",
|
name: row?.name ?? "",
|
||||||
@@ -127,23 +128,28 @@ export function useDept() {
|
|||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = formRef.value.getRef();
|
const FormRef = formRef.value.getRef();
|
||||||
const curData = options.props.formInline as FormItemProps;
|
const curData = options.props.formInline as FormItemProps;
|
||||||
function chores() {
|
FormRef.validate(valid => {
|
||||||
message(`您${title}了部门名称为${curData.name}的这条数据`, {
|
if (valid) {
|
||||||
|
// console.log("curData", curData);
|
||||||
|
// 表单规则校验通过
|
||||||
|
if (title === "新增") {
|
||||||
|
// 实际开发先调用新增接口,再进行下面操作
|
||||||
|
addDept(curData).then(_ => {
|
||||||
|
message("添加成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done(); // 关闭弹框
|
done(); // 关闭弹框
|
||||||
onSearch(); // 刷新表格数据
|
onSearch(); // 刷新表格数据
|
||||||
}
|
});
|
||||||
FormRef.validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
console.log("curData", curData);
|
|
||||||
// 表单规则校验通过
|
|
||||||
if (title === "新增") {
|
|
||||||
// 实际开发先调用新增接口,再进行下面操作
|
|
||||||
chores();
|
|
||||||
} else {
|
} else {
|
||||||
// 实际开发先调用修改接口,再进行下面操作
|
// 实际开发先调用修改接口,再进行下面操作
|
||||||
chores();
|
updateDept(curData).then(_ => {
|
||||||
|
message("修改成功", {
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
done(); // 关闭弹框
|
||||||
|
onSearch(); // 刷新表格数据
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
interface FormItemProps {
|
interface FormItemProps {
|
||||||
|
id: number;
|
||||||
higherDeptOptions: Record<string, unknown>[];
|
higherDeptOptions: Record<string, unknown>[];
|
||||||
parentId: number;
|
parentId: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
@@ -19,6 +19,7 @@ import {
|
|||||||
|
|
||||||
const props = withDefaults(defineProps<FormProps>(), {
|
const props = withDefaults(defineProps<FormProps>(), {
|
||||||
formInline: () => ({
|
formInline: () => ({
|
||||||
|
id: 0,
|
||||||
menuType: 0,
|
menuType: 0,
|
||||||
higherMenuOptions: [],
|
higherMenuOptions: [],
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
|
@@ -66,7 +66,7 @@ function onFullscreen() {
|
|||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<PureTableBar
|
<PureTableBar
|
||||||
title="菜单管理(仅演示,操作后不生效)"
|
title=""
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:isExpandAll="false"
|
:isExpandAll="false"
|
||||||
:tableRef="tableRef?.getTableRef()"
|
:tableRef="tableRef?.getTableRef()"
|
||||||
@@ -124,7 +124,8 @@ function onFullscreen() {
|
|||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
:title="`是否确认删除菜单名称为${transformI18n(row.title)}的这条数据${row?.children?.length > 0 ? '。注意下级菜单也会一并删除,请谨慎操作' : ''}`"
|
:title="`确认删除 [${transformI18n(row.title)}] ? ${row?.children?.length > 0 ? '。注意下级菜单也会一并删除,请谨慎操作' : ''}`"
|
||||||
|
width="250"
|
||||||
@confirm="handleDelete(row)"
|
@confirm="handleDelete(row)"
|
||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import editForm from "../form.vue";
|
import editForm from "../form.vue";
|
||||||
import { handleTree } from "@/utils/tree";
|
import { handleTree } from "@/utils/tree";
|
||||||
import { message } from "@/utils/message";
|
import { message } from "@/utils/message";
|
||||||
import { getMenuList } from "@/api/system";
|
import { getMenuList, addMenu, updateMenu, deleteMenu } from "@/api/system";
|
||||||
import { transformI18n } from "@/plugins/i18n";
|
import { transformI18n } from "@/plugins/i18n";
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
import { reactive, ref, onMounted, h } from "vue";
|
import { reactive, ref, onMounted, h } from "vue";
|
||||||
@@ -136,6 +136,7 @@ export function useMenu() {
|
|||||||
title: `${title}菜单`,
|
title: `${title}菜单`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
|
id: row?.id ?? 0,
|
||||||
menuType: row?.menuType ?? 0,
|
menuType: row?.menuType ?? 0,
|
||||||
higherMenuOptions: formatHigherMenuOptions(cloneDeep(dataList.value)),
|
higherMenuOptions: formatHigherMenuOptions(cloneDeep(dataList.value)),
|
||||||
parentId: row?.parentId ?? 0,
|
parentId: row?.parentId ?? 0,
|
||||||
@@ -152,7 +153,7 @@ export function useMenu() {
|
|||||||
activePath: row?.activePath ?? "",
|
activePath: row?.activePath ?? "",
|
||||||
auths: row?.auths ?? "",
|
auths: row?.auths ?? "",
|
||||||
frameSrc: row?.frameSrc ?? "",
|
frameSrc: row?.frameSrc ?? "",
|
||||||
frameLoading: row?.frameLoading ?? true,
|
frameLoading: row?.frameLoading ?? 1,
|
||||||
keepAlive: row?.keepAlive ?? false,
|
keepAlive: row?.keepAlive ?? false,
|
||||||
hiddenTag: row?.hiddenTag ?? false,
|
hiddenTag: row?.hiddenTag ?? false,
|
||||||
fixedTag: row?.fixedTag ?? false,
|
fixedTag: row?.fixedTag ?? false,
|
||||||
@@ -169,26 +170,25 @@ export function useMenu() {
|
|||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = formRef.value.getRef();
|
const FormRef = formRef.value.getRef();
|
||||||
const curData = options.props.formInline as FormItemProps;
|
const curData = options.props.formInline as FormItemProps;
|
||||||
function chores() {
|
|
||||||
message(
|
|
||||||
`您${title}了菜单名称为${transformI18n(curData.title)}的这条数据`,
|
|
||||||
{
|
|
||||||
type: "success"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
done(); // 关闭弹框
|
|
||||||
onSearch(); // 刷新表格数据
|
|
||||||
}
|
|
||||||
FormRef.validate(valid => {
|
FormRef.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
console.log("curData", curData);
|
|
||||||
// 表单规则校验通过
|
// 表单规则校验通过
|
||||||
if (title === "新增") {
|
if (title === "新增") {
|
||||||
// 实际开发先调用新增接口,再进行下面操作
|
addMenu(curData).then(_ => {
|
||||||
chores();
|
message("添加成功", {
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
done(); // 关闭弹框
|
||||||
|
onSearch(); // 刷新表格数据
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// 实际开发先调用修改接口,再进行下面操作
|
updateMenu(curData).then(_ => {
|
||||||
chores();
|
message("添加成功", {
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
done(); // 关闭弹框
|
||||||
|
onSearch(); // 刷新表格数据
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -197,10 +197,12 @@ export function useMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
message(`您删除了菜单名称为${transformI18n(row.title)}的这条数据`, {
|
deleteMenu(row).then(_ => {
|
||||||
|
message("删除成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
onSearch();
|
onSearch(); // 刷新表格数据
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
interface FormItemProps {
|
interface FormItemProps {
|
||||||
|
id: number;
|
||||||
/** 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)*/
|
/** 菜单类型(0代表菜单、1代表iframe、2代表外链、3代表按钮)*/
|
||||||
menuType: number;
|
menuType: number;
|
||||||
higherMenuOptions: Record<string, unknown>[];
|
higherMenuOptions: Record<string, unknown>[];
|
||||||
|
@@ -147,7 +147,7 @@ onMounted(() => {
|
|||||||
<PureTableBar
|
<PureTableBar
|
||||||
:class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']"
|
:class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']"
|
||||||
style="transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1)"
|
style="transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1)"
|
||||||
title="角色管理(仅演示,操作后不生效)"
|
title=""
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
@refresh="onSearch"
|
@refresh="onSearch"
|
||||||
>
|
>
|
||||||
|
@@ -16,7 +16,8 @@ import {
|
|||||||
getRoleList,
|
getRoleList,
|
||||||
getRoleMenu,
|
getRoleMenu,
|
||||||
getRoleMenuIds,
|
getRoleMenuIds,
|
||||||
updateRole
|
updateRole,
|
||||||
|
saveRoleMenu
|
||||||
} from "@/api/system";
|
} from "@/api/system";
|
||||||
import { type Ref, reactive, ref, onMounted, h, toRaw, watch } from "vue";
|
import { type Ref, reactive, ref, onMounted, h, toRaw, watch } from "vue";
|
||||||
import { StatusEnum } from "@/model/enums";
|
import { StatusEnum } from "@/model/enums";
|
||||||
@@ -245,12 +246,18 @@ export function useRole(treeRef: Ref) {
|
|||||||
|
|
||||||
/** 菜单权限-保存 */
|
/** 菜单权限-保存 */
|
||||||
function handleSave() {
|
function handleSave() {
|
||||||
const { id, name } = curRow.value;
|
const { id } = curRow.value;
|
||||||
// 根据用户 id 调用实际项目中菜单权限修改接口
|
// 根据用户 id 调用实际项目中菜单权限修改接口
|
||||||
console.log(id, treeRef.value.getCheckedKeys());
|
// console.log(id, treeRef.value.getCheckedKeys());
|
||||||
message(`角色名称为${name}的菜单权限修改成功`, {
|
const data = {
|
||||||
|
roleId: id,
|
||||||
|
resourceIds: treeRef.value.getCheckedKeys()
|
||||||
|
};
|
||||||
|
saveRoleMenu(data).then(_ => {
|
||||||
|
message(`修改成功`, {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 数据权限 可自行开发 */
|
/** 数据权限 可自行开发 */
|
||||||
|
@@ -7,6 +7,7 @@ import { usePublicHooks } from "../../hooks";
|
|||||||
|
|
||||||
const props = withDefaults(defineProps<FormProps>(), {
|
const props = withDefaults(defineProps<FormProps>(), {
|
||||||
formInline: () => ({
|
formInline: () => ({
|
||||||
|
id: 0,
|
||||||
title: "新增",
|
title: "新增",
|
||||||
higherDeptOptions: [],
|
higherDeptOptions: [],
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
@@ -15,7 +16,7 @@ const props = withDefaults(defineProps<FormProps>(), {
|
|||||||
password: "",
|
password: "",
|
||||||
phone: "",
|
phone: "",
|
||||||
email: "",
|
email: "",
|
||||||
sex: "",
|
gender: 0,
|
||||||
status: 1,
|
status: 1,
|
||||||
remark: ""
|
remark: ""
|
||||||
})
|
})
|
||||||
@@ -24,10 +25,14 @@ const props = withDefaults(defineProps<FormProps>(), {
|
|||||||
const sexOptions = [
|
const sexOptions = [
|
||||||
{
|
{
|
||||||
value: 0,
|
value: 0,
|
||||||
label: "男"
|
label: "未知"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 1,
|
value: 1,
|
||||||
|
label: "男"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
label: "女"
|
label: "女"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@@ -105,7 +110,7 @@ defineExpose({ getRef });
|
|||||||
<re-col :value="12" :xs="24" :sm="24">
|
<re-col :value="12" :xs="24" :sm="24">
|
||||||
<el-form-item label="用户性别">
|
<el-form-item label="用户性别">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="newFormInline.sex"
|
v-model="newFormInline.gender"
|
||||||
placeholder="请选择用户性别"
|
placeholder="请选择用户性别"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
clearable
|
clearable
|
||||||
|
@@ -35,7 +35,8 @@ const {
|
|||||||
deviceDetection,
|
deviceDetection,
|
||||||
onSearch,
|
onSearch,
|
||||||
resetForm,
|
resetForm,
|
||||||
onbatchDel,
|
onBatchDisable,
|
||||||
|
onBatchEnable,
|
||||||
openDialog,
|
openDialog,
|
||||||
onTreeSelect,
|
onTreeSelect,
|
||||||
handleUpdate,
|
handleUpdate,
|
||||||
@@ -110,11 +111,7 @@ const {
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<PureTableBar
|
<PureTableBar title="" :columns="columns" @refresh="onSearch">
|
||||||
title="用户管理(仅演示,操作后不生效)"
|
|
||||||
:columns="columns"
|
|
||||||
@refresh="onSearch"
|
|
||||||
>
|
|
||||||
<template #buttons>
|
<template #buttons>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -141,10 +138,17 @@ const {
|
|||||||
取消选择
|
取消选择
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-popconfirm title="是否确认删除?" @confirm="onbatchDel">
|
<el-popconfirm title="是否确认启用?" @confirm="onBatchEnable">
|
||||||
|
<template #reference>
|
||||||
|
<el-button type="success" text class="mr-1">
|
||||||
|
批量启用
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
<el-popconfirm title="是否确认禁用?" @confirm="onBatchDisable">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button type="danger" text class="mr-1">
|
<el-button type="danger" text class="mr-1">
|
||||||
批量删除
|
批量禁用
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
@@ -180,6 +184,27 @@ const {
|
|||||||
>
|
>
|
||||||
修改
|
修改
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
:class="buttonClass"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
:size="size"
|
||||||
|
:icon="useRenderIcon(Role)"
|
||||||
|
@click="handleRole(row)"
|
||||||
|
>
|
||||||
|
分配角色
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
:class="buttonClass"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
:size="size"
|
||||||
|
:icon="useRenderIcon(Password)"
|
||||||
|
@click="handleReset(row)"
|
||||||
|
>
|
||||||
|
重置密码
|
||||||
|
</el-button>
|
||||||
|
<!-- 不支持删除
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
:title="`是否确认删除用户编号为${row.id}的这条数据`"
|
:title="`是否确认删除用户编号为${row.id}的这条数据`"
|
||||||
@confirm="handleDelete(row)"
|
@confirm="handleDelete(row)"
|
||||||
@@ -195,7 +220,8 @@ const {
|
|||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>-->
|
||||||
|
<!--
|
||||||
<el-dropdown>
|
<el-dropdown>
|
||||||
<el-button
|
<el-button
|
||||||
class="ml-3 mt-[2px]"
|
class="ml-3 mt-[2px]"
|
||||||
@@ -219,33 +245,10 @@ const {
|
|||||||
上传头像
|
上传头像
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item>
|
|
||||||
<el-button
|
|
||||||
:class="buttonClass"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
:size="size"
|
|
||||||
:icon="useRenderIcon(Password)"
|
|
||||||
@click="handleReset(row)"
|
|
||||||
>
|
|
||||||
重置密码
|
|
||||||
</el-button>
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item>
|
|
||||||
<el-button
|
|
||||||
:class="buttonClass"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
:size="size"
|
|
||||||
:icon="useRenderIcon(Role)"
|
|
||||||
@click="handleRole(row)"
|
|
||||||
>
|
|
||||||
分配角色
|
|
||||||
</el-button>
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
-->
|
||||||
</template>
|
</template>
|
||||||
</pure-table>
|
</pure-table>
|
||||||
</template>
|
</template>
|
||||||
|
@@ -12,34 +12,42 @@ import type { PaginationProps } from "@pureadmin/table";
|
|||||||
import ReCropperPreview from "@/components/ReCropperPreview";
|
import ReCropperPreview from "@/components/ReCropperPreview";
|
||||||
import type { FormItemProps, RoleFormItemProps } from "../utils/types";
|
import type { FormItemProps, RoleFormItemProps } from "../utils/types";
|
||||||
import {
|
import {
|
||||||
|
deviceDetection,
|
||||||
getKeyList,
|
getKeyList,
|
||||||
isAllEmpty,
|
|
||||||
hideTextAtIndex,
|
hideTextAtIndex,
|
||||||
deviceDetection
|
isAllEmpty
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
import {
|
import {
|
||||||
getRoleIds,
|
addUser,
|
||||||
|
getAllRoleList,
|
||||||
getDeptList,
|
getDeptList,
|
||||||
|
getRoleIds,
|
||||||
getUserList,
|
getUserList,
|
||||||
getAllRoleList
|
resetPassword,
|
||||||
|
setUserRole,
|
||||||
|
updateStatusBatch,
|
||||||
|
updateUser,
|
||||||
|
updateUserStatus
|
||||||
} from "@/api/system";
|
} from "@/api/system";
|
||||||
import {
|
import {
|
||||||
ElForm,
|
ElForm,
|
||||||
ElInput,
|
|
||||||
ElFormItem,
|
ElFormItem,
|
||||||
ElProgress,
|
ElInput,
|
||||||
ElMessageBox
|
ElMessageBox,
|
||||||
|
ElProgress
|
||||||
} from "element-plus";
|
} from "element-plus";
|
||||||
import {
|
import {
|
||||||
type Ref,
|
|
||||||
h,
|
|
||||||
ref,
|
|
||||||
toRaw,
|
|
||||||
watch,
|
|
||||||
computed,
|
computed,
|
||||||
|
h,
|
||||||
|
onMounted,
|
||||||
reactive,
|
reactive,
|
||||||
onMounted
|
ref,
|
||||||
|
type Ref,
|
||||||
|
toRaw,
|
||||||
|
watch
|
||||||
} from "vue";
|
} from "vue";
|
||||||
|
import { StatusEnum } from "@/model/enums";
|
||||||
|
import CryptoJS from "crypto-js";
|
||||||
|
|
||||||
export function useUser(tableRef: Ref, treeRef: Ref) {
|
export function useUser(tableRef: Ref, treeRef: Ref) {
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
@@ -79,20 +87,20 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
prop: "id",
|
prop: "id",
|
||||||
width: 90
|
width: 90
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: "用户头像",
|
// label: "用户头像",
|
||||||
prop: "avatar",
|
// prop: "avatar",
|
||||||
cellRenderer: ({ row }) => (
|
// cellRenderer: ({ row }) => (
|
||||||
<el-image
|
// <el-image
|
||||||
fit="cover"
|
// fit="cover"
|
||||||
preview-teleported={true}
|
// preview-teleported={true}
|
||||||
src={row.avatar || userAvatar}
|
// src={row.avatar || userAvatar}
|
||||||
preview-src-list={Array.of(row.avatar || userAvatar)}
|
// preview-src-list={Array.of(row.avatar || userAvatar)}
|
||||||
class="w-[24px] h-[24px] rounded-full align-middle"
|
// class="w-[24px] h-[24px] rounded-full align-middle"
|
||||||
/>
|
// />
|
||||||
),
|
// ),
|
||||||
width: 90
|
// width: 90
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: "用户名称",
|
label: "用户名称",
|
||||||
prop: "username",
|
prop: "username",
|
||||||
@@ -105,15 +113,15 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "性别",
|
label: "性别",
|
||||||
prop: "sex",
|
prop: "gender",
|
||||||
minWidth: 90,
|
minWidth: 90,
|
||||||
cellRenderer: ({ row, props }) => (
|
cellRenderer: ({ row, props }) => (
|
||||||
<el-tag
|
<el-tag
|
||||||
size={props.size}
|
size={props.size}
|
||||||
type={row.sex === 1 ? "danger" : null}
|
type={row.gender === 2 ? "danger" : null}
|
||||||
effect="plain"
|
effect="plain"
|
||||||
>
|
>
|
||||||
{row.sex === 1 ? "女" : "男"}
|
{row.gender === 0 ? "未知" : row.gender === 2 ? "女" : "男"}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -157,7 +165,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
{
|
{
|
||||||
label: "操作",
|
label: "操作",
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
width: 180,
|
width: 260,
|
||||||
slot: "operation"
|
slot: "operation"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@@ -185,7 +193,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
const curScore = ref();
|
const curScore = ref();
|
||||||
const roleOptions = ref([]);
|
const roleOptions = ref([]);
|
||||||
|
|
||||||
function onChange({ row, index }) {
|
function onChange({ row }) {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
`确认要<strong>${
|
`确认要<strong>${
|
||||||
row.status === 0 ? "停用" : "启用"
|
row.status === 0 ? "停用" : "启用"
|
||||||
@@ -202,28 +210,16 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
switchLoadMap.value[index] = Object.assign(
|
updateUserStatus(row).then(_ => {
|
||||||
{},
|
message("操作成功", {
|
||||||
switchLoadMap.value[index],
|
|
||||||
{
|
|
||||||
loading: true
|
|
||||||
}
|
|
||||||
);
|
|
||||||
setTimeout(() => {
|
|
||||||
switchLoadMap.value[index] = Object.assign(
|
|
||||||
{},
|
|
||||||
switchLoadMap.value[index],
|
|
||||||
{
|
|
||||||
loading: false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
message("已成功修改用户状态", {
|
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
}, 300);
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
row.status === 0 ? (row.status = 1) : (row.status = 0);
|
row.status === StatusEnum.DISABLE
|
||||||
|
? (row.status = StatusEnum.ENABLE)
|
||||||
|
: (row.status = StatusEnum.DISABLE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,16 +254,31 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
tableRef.value.getTableRef().clearSelection();
|
tableRef.value.getTableRef().clearSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 批量删除 */
|
/** 批量禁用 */
|
||||||
function onbatchDel() {
|
function onBatchDisable() {
|
||||||
// 返回当前选中的行
|
// 返回当前选中的行
|
||||||
const curSelected = tableRef.value.getTableRef().getSelectionRows();
|
const curSelected = tableRef.value.getTableRef().getSelectionRows();
|
||||||
// 接下来根据实际业务,通过选中行的某项数据,比如下面的id,调用接口进行批量删除
|
doUpdateStatusBatch(getKeyList(curSelected, "id"), StatusEnum.DISABLE);
|
||||||
message(`已删除用户编号为 ${getKeyList(curSelected, "id")} 的数据`, {
|
}
|
||||||
|
|
||||||
|
/** 批量启用 */
|
||||||
|
function onBatchEnable() {
|
||||||
|
// 返回当前选中的行
|
||||||
|
const curSelected = tableRef.value.getTableRef().getSelectionRows();
|
||||||
|
doUpdateStatusBatch(getKeyList(curSelected, "id"), StatusEnum.ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doUpdateStatusBatch(ids: any, status: number) {
|
||||||
|
updateStatusBatch({
|
||||||
|
ids: ids,
|
||||||
|
status: status
|
||||||
|
}).then(_ => {
|
||||||
|
message("操作成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
tableRef.value.getTableRef().clearSelection();
|
tableRef.value.getTableRef().clearSelection();
|
||||||
onSearch();
|
onSearch();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onSearch() {
|
async function onSearch() {
|
||||||
@@ -301,7 +312,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
if (!treeList || !treeList.length) return;
|
if (!treeList || !treeList.length) return;
|
||||||
const newTreeList = [];
|
const newTreeList = [];
|
||||||
for (let i = 0; i < treeList.length; i++) {
|
for (let i = 0; i < treeList.length; i++) {
|
||||||
treeList[i].disabled = treeList[i].status === 0 ? true : false;
|
treeList[i].disabled = treeList[i].status === 0;
|
||||||
formatHigherDeptOptions(treeList[i].children);
|
formatHigherDeptOptions(treeList[i].children);
|
||||||
newTreeList.push(treeList[i]);
|
newTreeList.push(treeList[i]);
|
||||||
}
|
}
|
||||||
@@ -313,15 +324,16 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
title: `${title}用户`,
|
title: `${title}用户`,
|
||||||
props: {
|
props: {
|
||||||
formInline: {
|
formInline: {
|
||||||
|
id: row?.id ?? 0,
|
||||||
title,
|
title,
|
||||||
higherDeptOptions: formatHigherDeptOptions(higherDeptOptions.value),
|
higherDeptOptions: formatHigherDeptOptions(higherDeptOptions.value),
|
||||||
parentId: row?.dept.id ?? 0,
|
parentId: row?.dept?.id ?? 0,
|
||||||
nickname: row?.nickname ?? "",
|
nickname: row?.nickname ?? "",
|
||||||
username: row?.username ?? "",
|
username: row?.username ?? "",
|
||||||
password: row?.password ?? "",
|
password: row?.password ?? "",
|
||||||
phone: row?.phone ?? "",
|
phone: row?.phone ?? "",
|
||||||
email: row?.email ?? "",
|
email: row?.email ?? "",
|
||||||
sex: row?.sex ?? "",
|
gender: row?.gender ?? 0,
|
||||||
status: row?.status ?? 1,
|
status: row?.status ?? 1,
|
||||||
remark: row?.remark ?? ""
|
remark: row?.remark ?? ""
|
||||||
}
|
}
|
||||||
@@ -335,23 +347,31 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const FormRef = formRef.value.getRef();
|
const FormRef = formRef.value.getRef();
|
||||||
const curData = options.props.formInline as FormItemProps;
|
const curData = options.props.formInline as FormItemProps;
|
||||||
function chores() {
|
FormRef.validate(valid => {
|
||||||
message(`您${title}了用户名称为${curData.username}的这条数据`, {
|
if (valid) {
|
||||||
|
// 表单规则校验通过
|
||||||
|
if (title === "新增") {
|
||||||
|
const data = {
|
||||||
|
password: ""
|
||||||
|
};
|
||||||
|
Object.assign(data, curData);
|
||||||
|
const pwd = curData.password;
|
||||||
|
data.password = CryptoJS.SHA256(pwd).toString();
|
||||||
|
addUser(data).then(_ => {
|
||||||
|
message("添加成功", {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
done(); // 关闭弹框
|
done(); // 关闭弹框
|
||||||
onSearch(); // 刷新表格数据
|
onSearch(); // 刷新表格数据
|
||||||
}
|
});
|
||||||
FormRef.validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
console.log("curData", curData);
|
|
||||||
// 表单规则校验通过
|
|
||||||
if (title === "新增") {
|
|
||||||
// 实际开发先调用新增接口,再进行下面操作
|
|
||||||
chores();
|
|
||||||
} else {
|
} else {
|
||||||
// 实际开发先调用修改接口,再进行下面操作
|
updateUser(curData).then(_ => {
|
||||||
chores();
|
message("修改成功", {
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
done(); // 关闭弹框
|
||||||
|
onSearch(); // 刷新表格数据
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -450,13 +470,18 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
ruleFormRef.value.validate(valid => {
|
ruleFormRef.value.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// 表单规则校验通过
|
// 表单规则校验通过
|
||||||
|
const pwd = pwdForm.newPwd;
|
||||||
|
const hash = CryptoJS.SHA256(pwd).toString();
|
||||||
|
resetPassword({
|
||||||
|
userId: row.id,
|
||||||
|
passwordHash: hash
|
||||||
|
}).then(_ => {
|
||||||
message(`已成功重置 ${row.username} 用户的密码`, {
|
message(`已成功重置 ${row.username} 用户的密码`, {
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
console.log(pwdForm.newPwd);
|
|
||||||
// 根据实际业务使用pwdForm.newPwd和row里的某些字段去调用重置用户密码接口即可
|
|
||||||
done(); // 关闭弹框
|
done(); // 关闭弹框
|
||||||
onSearch(); // 刷新表格数据
|
onSearch(); // 刷新表格数据
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -485,9 +510,16 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
contentRenderer: () => h(roleForm),
|
contentRenderer: () => h(roleForm),
|
||||||
beforeSure: (done, { options }) => {
|
beforeSure: (done, { options }) => {
|
||||||
const curData = options.props.formInline as RoleFormItemProps;
|
const curData = options.props.formInline as RoleFormItemProps;
|
||||||
console.log("curIds", curData.ids);
|
|
||||||
// 根据实际业务使用curData.ids和row里的某些字段去调用修改角色接口即可
|
// 根据实际业务使用curData.ids和row里的某些字段去调用修改角色接口即可
|
||||||
|
setUserRole({
|
||||||
|
userId: row.id,
|
||||||
|
roleIds: curData.ids
|
||||||
|
}).then(_ => {
|
||||||
|
message("操作成功", {
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
done(); // 关闭弹框
|
done(); // 关闭弹框
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -519,7 +551,8 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
|||||||
deviceDetection,
|
deviceDetection,
|
||||||
onSearch,
|
onSearch,
|
||||||
resetForm,
|
resetForm,
|
||||||
onbatchDel,
|
onBatchDisable,
|
||||||
|
onBatchEnable,
|
||||||
openDialog,
|
openDialog,
|
||||||
onTreeSelect,
|
onTreeSelect,
|
||||||
handleUpdate,
|
handleUpdate,
|
||||||
|
@@ -9,7 +9,7 @@ interface FormItemProps {
|
|||||||
password: string;
|
password: string;
|
||||||
phone: string | number;
|
phone: string | number;
|
||||||
email: string;
|
email: string;
|
||||||
sex: string | number;
|
gender: string | number;
|
||||||
status: number;
|
status: number;
|
||||||
dept?: {
|
dept?: {
|
||||||
id?: number;
|
id?: number;
|
||||||
|
@@ -22,7 +22,7 @@ const frameRef = ref<HTMLElement | null>(null);
|
|||||||
if (unref(currentRoute.meta)?.frameSrc) {
|
if (unref(currentRoute.meta)?.frameSrc) {
|
||||||
frameSrc.value = unref(currentRoute.meta)?.frameSrc as string;
|
frameSrc.value = unref(currentRoute.meta)?.frameSrc as string;
|
||||||
}
|
}
|
||||||
unref(currentRoute.meta)?.frameLoading === false && hideLoading();
|
unref(currentRoute.meta)?.frameLoading === 0 && hideLoading();
|
||||||
|
|
||||||
function hideLoading() {
|
function hideLoading() {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
@@ -34,12 +34,20 @@
|
|||||||
a {
|
a {
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #409eff;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.is-bordered-label {
|
.is-bordered-label {
|
||||||
width: 200px !important;
|
width: 200px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sop-link {
|
.el-table .cell a {
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
|
.el-table .cell a:hover {
|
||||||
|
color: #409eff;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
@@ -1,23 +1,16 @@
|
|||||||
import { computed, ref } from "vue";
|
import { computed, nextTick, onMounted, ref } from "vue";
|
||||||
import { api as docApi } from "@/api/doc";
|
import { api as docApi } from "@/api/doc";
|
||||||
import { DocType } from "@/model/enum";
|
import { DocType } from "@/model/enum";
|
||||||
|
|
||||||
export const defaultActive = ref("overview.md");
|
export function useDocApi() {
|
||||||
export const activeIndex = ref("1");
|
const dataNodeType = ref("Object");
|
||||||
export const content = ref("");
|
const defaultExpandedKeys = ref([]);
|
||||||
export const contentShow = ref(false);
|
const currentNodeKey = ref(0);
|
||||||
export const openMenu = ref([]);
|
|
||||||
export const apiModules = ref([]);
|
|
||||||
export const dataNodeType = ref("Object");
|
|
||||||
export const requestParamsExample = ref({});
|
|
||||||
export const responseParamsExample = ref({});
|
|
||||||
export const defaultExpandedKeys = ref([]);
|
|
||||||
export const currentNodeKey = ref(0);
|
|
||||||
|
|
||||||
export const docAppId = ref(0);
|
const docAppId = ref(0);
|
||||||
export const docAppList = ref([]);
|
const docAppList = ref([]);
|
||||||
export const docTree = ref([]);
|
const docTree = ref([]);
|
||||||
export const docDetail = ref({
|
const docDetail = ref({
|
||||||
docInfoView: {
|
docInfoView: {
|
||||||
url: "",
|
url: "",
|
||||||
version: "",
|
version: "",
|
||||||
@@ -33,36 +26,36 @@ export const docDetail = ref({
|
|||||||
openProdUrl: "",
|
openProdUrl: "",
|
||||||
openSandboxUrl: ""
|
openSandboxUrl: ""
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const showUrl = computed(() => {
|
const showUrl = computed(() => {
|
||||||
return (
|
return (
|
||||||
docDetail.value.docInfoConfig?.openProdUrl?.length > 0 &&
|
docDetail.value.docInfoConfig?.openProdUrl?.length > 0 &&
|
||||||
docDetail.value.docInfoConfig?.openSandboxUrl?.length > 0
|
docDetail.value.docInfoConfig?.openSandboxUrl?.length > 0
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
export const showProdUrl = computed(() => {
|
const showProdUrl = computed(() => {
|
||||||
return docDetail.value.docInfoConfig?.openProdUrl?.length > 0;
|
return docDetail.value.docInfoConfig?.openProdUrl?.length > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
export const showSandBoxUrl = computed(() => {
|
const showSandBoxUrl = computed(() => {
|
||||||
return docDetail.value.docInfoConfig?.openSandboxUrl?.length > 0;
|
return docDetail.value.docInfoConfig?.openSandboxUrl?.length > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
export const showDoc = computed(() => {
|
const showDoc = computed(() => {
|
||||||
return docDetail.value?.docInfoView?.url?.length > 0;
|
return docDetail.value?.docInfoView?.url?.length > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
export const isMarkdown = computed(() => {
|
const isMarkdown = computed(() => {
|
||||||
return docDetail.value?.docInfoView?.type === DocType.MARKDOWN;
|
return docDetail.value?.docInfoView?.type === DocType.MARKDOWN;
|
||||||
});
|
});
|
||||||
|
|
||||||
export const isDoc = computed(() => {
|
const isDoc = computed(() => {
|
||||||
return docDetail.value?.docInfoView?.type === DocType.DOC;
|
return docDetail.value?.docInfoView?.type === DocType.DOC;
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
参数 类型 是否必填 最大长度 描述 示例值
|
参数 类型 是否必填 最大长度 描述 示例值
|
||||||
app_id String 是 32 平台分配给开发者的应用ID 2014072300007148
|
app_id String 是 32 平台分配给开发者的应用ID 2014072300007148
|
||||||
method String 是 128 接口名称 alipay.trade.fastpay.refund.query
|
method String 是 128 接口名称 alipay.trade.fastpay.refund.query
|
||||||
@@ -75,7 +68,7 @@ export const isDoc = computed(() => {
|
|||||||
app_auth_token String 否 40 详见应用授权概述
|
app_auth_token String 否 40 详见应用授权概述
|
||||||
biz_content String 是 请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档
|
biz_content String 是 请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档
|
||||||
*/
|
*/
|
||||||
export const commonParams = ref([
|
const commonParams = ref([
|
||||||
{
|
{
|
||||||
name: "app_id",
|
name: "app_id",
|
||||||
type: "String",
|
type: "String",
|
||||||
@@ -157,8 +150,8 @@ export const commonParams = ref([
|
|||||||
"请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档",
|
"请求参数的集合,最大长度不限,除公共参数外所有请求参数都必须放在这个参数中传递,具体参照各产品快速接入文档",
|
||||||
example: ""
|
example: ""
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
export const resultData = ref([
|
const resultData = ref([
|
||||||
{
|
{
|
||||||
name: "code",
|
name: "code",
|
||||||
type: "String",
|
type: "String",
|
||||||
@@ -189,26 +182,26 @@ export const resultData = ref([
|
|||||||
description: "返回数据,见下表 业务返回参数",
|
description: "返回数据,见下表 业务返回参数",
|
||||||
example: ""
|
example: ""
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export function onMenuClick(index) {
|
/*function onMenuClick(index) {
|
||||||
if (index.endsWith(".md")) {
|
if (index.endsWith(".md")) {
|
||||||
this.loadMarkdown(index);
|
this.loadMarkdown(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadMarkdown(path) {
|
function loadMarkdown(path) {
|
||||||
this.getFile(`static/openapi/${path}?q=${new Date().getTime()}`, cont => {
|
this.getFile(`static/openapi/${path}?q=${new Date().getTime()}`, cont => {
|
||||||
content.value = cont;
|
content.value = cont;
|
||||||
contentShow.value = true;
|
contentShow.value = true;
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
export function handleChangeDocApp(id) {
|
function handleChangeDocApp(id) {
|
||||||
loadDocTree(id);
|
loadDocTree(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleNodeClick(node) {
|
function handleNodeClick(node) {
|
||||||
if (node.isFolder === 1) {
|
if (node.isFolder === 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -218,18 +211,18 @@ export function handleNodeClick(node) {
|
|||||||
docApi.getDocDetail(params).then(resp => {
|
docApi.getDocDetail(params).then(resp => {
|
||||||
docDetail.value = resp.data;
|
docDetail.value = resp.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadDocApp() {
|
function loadDocApp() {
|
||||||
docApi.listApp().then(resp => {
|
docApi.listApp().then(resp => {
|
||||||
docAppList.value = resp.data;
|
docAppList.value = resp.data;
|
||||||
if (docAppList.value.length > 0) {
|
if (docAppList.value.length > 0) {
|
||||||
loadDocTree(docAppList.value[0].id);
|
loadDocTree(docAppList.value[0].id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadDocTree(id) {
|
function loadDocTree(id) {
|
||||||
docAppId.value = id;
|
docAppId.value = id;
|
||||||
const params = {
|
const params = {
|
||||||
docAppId: id
|
docAppId: id
|
||||||
@@ -241,12 +234,37 @@ function loadDocTree(id) {
|
|||||||
defaultExpandedKeys.value.push(docTree.value[0].docId);
|
defaultExpandedKeys.value.push(docTree.value[0].docId);
|
||||||
const children = docTree.value[0]?.children;
|
const children = docTree.value[0]?.children;
|
||||||
if (children && children.length > 0) {
|
if (children && children.length > 0) {
|
||||||
|
nextTick(() => {
|
||||||
const firstNode = children[0];
|
const firstNode = children[0];
|
||||||
currentNodeKey.value = firstNode.docId;
|
currentNodeKey.value = firstNode.docId;
|
||||||
handleNodeClick(firstNode);
|
handleNodeClick(firstNode);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDocApp();
|
onMounted(() => {
|
||||||
|
loadDocApp();
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
isMarkdown,
|
||||||
|
isDoc,
|
||||||
|
docDetail,
|
||||||
|
commonParams,
|
||||||
|
dataNodeType,
|
||||||
|
resultData,
|
||||||
|
handleChangeDocApp,
|
||||||
|
docAppId,
|
||||||
|
docAppList,
|
||||||
|
docTree,
|
||||||
|
handleNodeClick,
|
||||||
|
showUrl,
|
||||||
|
showProdUrl,
|
||||||
|
showSandBoxUrl,
|
||||||
|
showDoc,
|
||||||
|
defaultExpandedKeys,
|
||||||
|
currentNodeKey
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import { useDocApi } from "./index";
|
||||||
|
const {
|
||||||
isMarkdown,
|
isMarkdown,
|
||||||
isDoc,
|
isDoc,
|
||||||
content,
|
|
||||||
docDetail,
|
docDetail,
|
||||||
commonParams,
|
commonParams,
|
||||||
dataNodeType,
|
dataNodeType,
|
||||||
@@ -18,10 +18,8 @@ import {
|
|||||||
showDoc,
|
showDoc,
|
||||||
defaultExpandedKeys,
|
defaultExpandedKeys,
|
||||||
currentNodeKey
|
currentNodeKey
|
||||||
} from "./index";
|
} = useDocApi();
|
||||||
import { ApiParamTable } from "@/components/ApiParamTable";
|
import { ApiParamTable } from "@/components/ApiParamTable";
|
||||||
import { useRouter } from "vue-router";
|
|
||||||
const router = useRouter();
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: "children",
|
children: "children",
|
||||||
label: "docTitle"
|
label: "docTitle"
|
||||||
@@ -114,11 +112,7 @@ const defaultProps = {
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.name === 'sign'">
|
<span v-if="scope.row.name === 'sign'">
|
||||||
商户请求参数的签名串,详见
|
商户请求参数的签名串,详见
|
||||||
<router-link
|
<router-link :to="{ name: 'DocSign' }" target="_blank">
|
||||||
:to="{ name: 'DocSign' }"
|
|
||||||
target="_blank"
|
|
||||||
class="sop-link"
|
|
||||||
>
|
|
||||||
签名算法
|
签名算法
|
||||||
</router-link>
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
|
Reference in New Issue
Block a user