登录设置权限 0.1
This commit is contained in:
parent
163912046b
commit
ebf322cde3
|
@ -17,6 +17,8 @@ public class User implements Serializable {
|
||||||
|
|
||||||
private Long updateTime;
|
private Long updateTime;
|
||||||
|
|
||||||
|
private String lastSourceId;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -74,4 +76,12 @@ public class User implements Serializable {
|
||||||
public void setUpdateTime(Long updateTime) {
|
public void setUpdateTime(Long updateTime) {
|
||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLastSourceId() {
|
||||||
|
return lastSourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastSourceId(String lastSourceId) {
|
||||||
|
this.lastSourceId = lastSourceId == null ? null : lastSourceId.trim();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -573,6 +573,76 @@ public class UserExample {
|
||||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdIsNull() {
|
||||||
|
addCriterion("last_source_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdIsNotNull() {
|
||||||
|
addCriterion("last_source_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdEqualTo(String value) {
|
||||||
|
addCriterion("last_source_id =", value, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdNotEqualTo(String value) {
|
||||||
|
addCriterion("last_source_id <>", value, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdGreaterThan(String value) {
|
||||||
|
addCriterion("last_source_id >", value, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("last_source_id >=", value, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdLessThan(String value) {
|
||||||
|
addCriterion("last_source_id <", value, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("last_source_id <=", value, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdLike(String value) {
|
||||||
|
addCriterion("last_source_id like", value, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdNotLike(String value) {
|
||||||
|
addCriterion("last_source_id not like", value, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdIn(List<String> values) {
|
||||||
|
addCriterion("last_source_id in", values, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdNotIn(List<String> values) {
|
||||||
|
addCriterion("last_source_id not in", values, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("last_source_id between", value1, value2, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andLastSourceIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("last_source_id not between", value1, value2, "lastSourceId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class UserRole implements Serializable {
|
||||||
|
|
||||||
private String roleId;
|
private String roleId;
|
||||||
|
|
||||||
private String resourceId;
|
private String sourceId;
|
||||||
|
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
||||||
|
@ -41,12 +41,12 @@ public class UserRole implements Serializable {
|
||||||
this.roleId = roleId == null ? null : roleId.trim();
|
this.roleId = roleId == null ? null : roleId.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResourceId() {
|
public String getSourceId() {
|
||||||
return resourceId;
|
return sourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResourceId(String resourceId) {
|
public void setSourceId(String sourceId) {
|
||||||
this.resourceId = resourceId == null ? null : resourceId.trim();
|
this.sourceId = sourceId == null ? null : sourceId.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getCreateTime() {
|
public Long getCreateTime() {
|
||||||
|
|
|
@ -314,73 +314,73 @@ public class UserRoleExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdIsNull() {
|
public Criteria andSourceIdIsNull() {
|
||||||
addCriterion("resource_id is null");
|
addCriterion("source_id is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdIsNotNull() {
|
public Criteria andSourceIdIsNotNull() {
|
||||||
addCriterion("resource_id is not null");
|
addCriterion("source_id is not null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdEqualTo(String value) {
|
public Criteria andSourceIdEqualTo(String value) {
|
||||||
addCriterion("resource_id =", value, "resourceId");
|
addCriterion("source_id =", value, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdNotEqualTo(String value) {
|
public Criteria andSourceIdNotEqualTo(String value) {
|
||||||
addCriterion("resource_id <>", value, "resourceId");
|
addCriterion("source_id <>", value, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdGreaterThan(String value) {
|
public Criteria andSourceIdGreaterThan(String value) {
|
||||||
addCriterion("resource_id >", value, "resourceId");
|
addCriterion("source_id >", value, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
|
public Criteria andSourceIdGreaterThanOrEqualTo(String value) {
|
||||||
addCriterion("resource_id >=", value, "resourceId");
|
addCriterion("source_id >=", value, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdLessThan(String value) {
|
public Criteria andSourceIdLessThan(String value) {
|
||||||
addCriterion("resource_id <", value, "resourceId");
|
addCriterion("source_id <", value, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdLessThanOrEqualTo(String value) {
|
public Criteria andSourceIdLessThanOrEqualTo(String value) {
|
||||||
addCriterion("resource_id <=", value, "resourceId");
|
addCriterion("source_id <=", value, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdLike(String value) {
|
public Criteria andSourceIdLike(String value) {
|
||||||
addCriterion("resource_id like", value, "resourceId");
|
addCriterion("source_id like", value, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdNotLike(String value) {
|
public Criteria andSourceIdNotLike(String value) {
|
||||||
addCriterion("resource_id not like", value, "resourceId");
|
addCriterion("source_id not like", value, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdIn(List<String> values) {
|
public Criteria andSourceIdIn(List<String> values) {
|
||||||
addCriterion("resource_id in", values, "resourceId");
|
addCriterion("source_id in", values, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdNotIn(List<String> values) {
|
public Criteria andSourceIdNotIn(List<String> values) {
|
||||||
addCriterion("resource_id not in", values, "resourceId");
|
addCriterion("source_id not in", values, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdBetween(String value1, String value2) {
|
public Criteria andSourceIdBetween(String value1, String value2) {
|
||||||
addCriterion("resource_id between", value1, value2, "resourceId");
|
addCriterion("source_id between", value1, value2, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andResourceIdNotBetween(String value1, String value2) {
|
public Criteria andSourceIdNotBetween(String value1, String value2) {
|
||||||
addCriterion("resource_id not between", value1, value2, "resourceId");
|
addCriterion("source_id not between", value1, value2, "sourceId");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
|
||||||
|
|
||||||
import io.metersphere.base.domain.User;
|
import io.metersphere.base.domain.User;
|
||||||
import io.metersphere.base.domain.UserExample;
|
import io.metersphere.base.domain.UserExample;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
public interface UserMapper {
|
public interface UserMapper {
|
||||||
long countByExample(UserExample example);
|
long countByExample(UserExample example);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||||
|
<result column="last_source_id" jdbcType="VARCHAR" property="lastSourceId" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
<where>
|
<where>
|
||||||
|
@ -69,7 +70,7 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, name, email, phone, status, create_time, update_time
|
id, name, email, phone, status, create_time, update_time, last_source_id
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
@ -104,10 +105,10 @@
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.User">
|
<insert id="insert" parameterType="io.metersphere.base.domain.User">
|
||||||
insert into user (id, name, email,
|
insert into user (id, name, email,
|
||||||
phone, status, create_time,
|
phone, status, create_time,
|
||||||
update_time)
|
update_time, last_source_id)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
|
||||||
#{phone,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
#{phone,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||||
#{updateTime,jdbcType=BIGINT})
|
#{updateTime,jdbcType=BIGINT}, #{lastSourceId,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.User">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.User">
|
||||||
insert into user
|
insert into user
|
||||||
|
@ -133,6 +134,9 @@
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
update_time,
|
update_time,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lastSourceId != null">
|
||||||
|
last_source_id,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
@ -156,6 +160,9 @@
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
#{updateTime,jdbcType=BIGINT},
|
#{updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lastSourceId != null">
|
||||||
|
#{lastSourceId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.UserExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="io.metersphere.base.domain.UserExample" resultType="java.lang.Long">
|
||||||
|
@ -188,6 +195,9 @@
|
||||||
<if test="record.updateTime != null">
|
<if test="record.updateTime != null">
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.lastSourceId != null">
|
||||||
|
last_source_id = #{record.lastSourceId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
@ -201,7 +211,8 @@
|
||||||
phone = #{record.phone,jdbcType=VARCHAR},
|
phone = #{record.phone,jdbcType=VARCHAR},
|
||||||
status = #{record.status,jdbcType=VARCHAR},
|
status = #{record.status,jdbcType=VARCHAR},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
|
last_source_id = #{record.lastSourceId,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -227,6 +238,9 @@
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="lastSourceId != null">
|
||||||
|
last_source_id = #{lastSourceId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
@ -237,7 +251,8 @@
|
||||||
phone = #{phone,jdbcType=VARCHAR},
|
phone = #{phone,jdbcType=VARCHAR},
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT}
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
|
last_source_id = #{lastSourceId,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -2,9 +2,8 @@ package io.metersphere.base.mapper;
|
||||||
|
|
||||||
import io.metersphere.base.domain.UserRole;
|
import io.metersphere.base.domain.UserRole;
|
||||||
import io.metersphere.base.domain.UserRoleExample;
|
import io.metersphere.base.domain.UserRoleExample;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
public interface UserRoleMapper {
|
public interface UserRoleMapper {
|
||||||
long countByExample(UserRoleExample example);
|
long countByExample(UserRoleExample example);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||||
<result column="role_id" jdbcType="VARCHAR" property="roleId" />
|
<result column="role_id" jdbcType="VARCHAR" property="roleId" />
|
||||||
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
|
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, user_id, role_id, resource_id, create_time, update_time
|
id, user_id, role_id, source_id, create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserRoleExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.UserRoleExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
@ -102,10 +102,10 @@
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.UserRole">
|
<insert id="insert" parameterType="io.metersphere.base.domain.UserRole">
|
||||||
insert into user_role (id, user_id, role_id,
|
insert into user_role (id, user_id, role_id,
|
||||||
resource_id, create_time, update_time
|
source_id, create_time, update_time
|
||||||
)
|
)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{roleId,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{roleId,jdbcType=VARCHAR},
|
||||||
#{resourceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
|
#{sourceId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UserRole">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.UserRole">
|
||||||
|
@ -120,8 +120,8 @@
|
||||||
<if test="roleId != null">
|
<if test="roleId != null">
|
||||||
role_id,
|
role_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="resourceId != null">
|
<if test="sourceId != null">
|
||||||
resource_id,
|
source_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time,
|
create_time,
|
||||||
|
@ -140,8 +140,8 @@
|
||||||
<if test="roleId != null">
|
<if test="roleId != null">
|
||||||
#{roleId,jdbcType=VARCHAR},
|
#{roleId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="resourceId != null">
|
<if test="sourceId != null">
|
||||||
#{resourceId,jdbcType=VARCHAR},
|
#{sourceId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
#{createTime,jdbcType=BIGINT},
|
#{createTime,jdbcType=BIGINT},
|
||||||
|
@ -169,8 +169,8 @@
|
||||||
<if test="record.roleId != null">
|
<if test="record.roleId != null">
|
||||||
role_id = #{record.roleId,jdbcType=VARCHAR},
|
role_id = #{record.roleId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.resourceId != null">
|
<if test="record.sourceId != null">
|
||||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
source_id = #{record.sourceId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.createTime != null">
|
<if test="record.createTime != null">
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||||
role_id = #{record.roleId,jdbcType=VARCHAR},
|
role_id = #{record.roleId,jdbcType=VARCHAR},
|
||||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
source_id = #{record.sourceId,jdbcType=VARCHAR},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
|
@ -204,8 +204,8 @@
|
||||||
<if test="roleId != null">
|
<if test="roleId != null">
|
||||||
role_id = #{roleId,jdbcType=VARCHAR},
|
role_id = #{roleId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="resourceId != null">
|
<if test="sourceId != null">
|
||||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
source_id = #{sourceId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
update user_role
|
update user_role
|
||||||
set user_id = #{userId,jdbcType=VARCHAR},
|
set user_id = #{userId,jdbcType=VARCHAR},
|
||||||
role_id = #{roleId,jdbcType=VARCHAR},
|
role_id = #{roleId,jdbcType=VARCHAR},
|
||||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
source_id = #{sourceId,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT}
|
update_time = #{updateTime,jdbcType=BIGINT}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export const TokenKey = 'Admin-Token';
|
|
@ -42,8 +42,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
|
import {TokenKey} from '../common/constants';
|
||||||
|
|
||||||
const TokenKey = 'Admin-Token';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Login",
|
name: "Login",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<router-link to="/content">
|
<router-link to="/content">
|
||||||
<font-awesome-icon :icon="['fas', 'user-plus']" size="lg"/>
|
<font-awesome-icon :icon="['fas', 'user-plus']" size="lg"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link to="/content">
|
<router-link to="/setting">
|
||||||
<font-awesome-icon :icon="['fas', 'cog']" size="lg"/>
|
<font-awesome-icon :icon="['fas', 'cog']" size="lg"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
|
import {TokenKey} from '../../common/constants';
|
||||||
const TokenKey = 'Admin-Token';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsUser",
|
name: "MsUser",
|
||||||
computed: {
|
computed: {
|
||||||
currentUser: () => {
|
currentUser: () => {
|
||||||
let user = Cookies.get(TokenKey);
|
let user = Cookies.get(TokenKey);
|
||||||
|
window.console.log(user);
|
||||||
return JSON.parse(user);
|
return JSON.parse(user);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
break;
|
break;
|
||||||
case "logout":
|
case "logout":
|
||||||
this.$get("/signout", function () {
|
this.$get("/signout", function () {
|
||||||
|
Cookies.remove(TokenKey);
|
||||||
window.location.href = "/login";
|
window.location.href = "/login";
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,7 +18,7 @@ const router = new VueRouter({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/content", components: {
|
path: "/setting", components: {
|
||||||
content: Setting
|
content: Setting
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
@ -26,17 +26,24 @@ const router = new VueRouter({
|
||||||
path: 'workspace',
|
path: 'workspace',
|
||||||
component: Workspace,
|
component: Workspace,
|
||||||
meta: {
|
meta: {
|
||||||
roles: ['admin']
|
roles: ['org_admin']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'user',
|
path: 'user',
|
||||||
component: User
|
component: User,
|
||||||
|
meta: {
|
||||||
|
roles: ['admin']
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'organization',
|
path: 'organization',
|
||||||
component: Organization
|
component: Organization,
|
||||||
},{
|
meta: {
|
||||||
|
roles: ['admin']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
path: 'workspace/user',
|
path: 'workspace/user',
|
||||||
component: WorkspaceUser
|
component: WorkspaceUser
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import ajax from "../common/ajax";
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
import router from "./components/router/router";
|
import router from "./components/router/router";
|
||||||
import store from './store'
|
import store from './store'
|
||||||
|
import './permission' // permission control
|
||||||
import i18n from "../i18n/i18n";
|
import i18n from "../i18n/i18n";
|
||||||
import timestampFormatDate from "./components/common/filter/TimestampFormatDateFilter";
|
import timestampFormatDate from "./components/common/filter/TimestampFormatDateFilter";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
import router from './components/router/router'
|
||||||
|
import Cookies from 'js-cookie' // get token from cookie
|
||||||
|
import {TokenKey} from '../common/constants';
|
||||||
|
|
||||||
|
|
||||||
|
const whiteList = ['/login']; // no redirect whitelist
|
||||||
|
|
||||||
|
router.beforeEach(async (to, from, next) => {
|
||||||
|
|
||||||
|
// determine whether the user has logged in
|
||||||
|
const user = JSON.parse(Cookies.get(TokenKey));
|
||||||
|
|
||||||
|
if (user && user.roles.length > 0) {
|
||||||
|
if (to.path === '/login') {
|
||||||
|
next({path: '/'});
|
||||||
|
} else {
|
||||||
|
// const roles = user.roles.filter(r => r.id);
|
||||||
|
// TODO 设置路由的权限
|
||||||
|
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* has no token*/
|
||||||
|
|
||||||
|
if (whiteList.indexOf(to.path) !== -1) {
|
||||||
|
// in the free login whitelist, go directly
|
||||||
|
next()
|
||||||
|
} else {
|
||||||
|
// other pages that do not have permission to access are redirected to the login page.
|
||||||
|
next(`/login`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.afterEach(() => {
|
||||||
|
// finish progress bar
|
||||||
|
});
|
Loading…
Reference in New Issue