Former-commit-id: b5e32c0e3eef1bd3490b8a44b0bcea8e0828c213
master
wangbing 5 years ago
parent e18bed1d9f
commit 53f8dec474

@ -732,6 +732,7 @@ public class SpringBootCallable implements Callable {
File fonts = Tool.createPath(dist.getAbsolutePath(), "fonts");
Tool.outputResource(option + "/resources/static/dist/fonts/w-e-icon.woff", Tool.createFile(fonts.getAbsolutePath(), "w-e-icon.woff"));
Tool.outputResource(option + "/resources/static/dist/fonts/element-icons.woff", Tool.createFile(fonts.getAbsolutePath(), "element-icons.woff"));
Tool.outputResource(option + "/resources/static/dist/fonts/element-icons.ttf", Tool.createFile(fonts.getAbsolutePath(), "element-icons.ttf"));
}
}

@ -7,7 +7,7 @@ import ${basePackage}.frame.base.BaseEntity;
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
* @since 2020-01-08
*/
public class UserRole extends BaseEntity {
@ -15,10 +15,18 @@ public class UserRole extends BaseEntity {
* USER_ID -
*/
private Long userId;
/**
* USER_CODE -
*/
private String userCode;
/**
* ROLE_ID -
*/
private Long roleId;
/**
* ROLE_CODE -
*/
private String roleCode;
public Long getUserId() {
return this.userId;
@ -28,6 +36,14 @@ public class UserRole extends BaseEntity {
this.userId = userId;
}
public String getUserCode() {
return this.userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public Long getRoleId() {
return this.roleId;
}
@ -35,4 +51,12 @@ public class UserRole extends BaseEntity {
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
}

@ -1,4 +1,4 @@
package ${basePackage}.module.system.mgr;
package xyz.wbsite.module.system.mgr;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -6,24 +6,27 @@ import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.base.Token;
import ${basePackage}.frame.utils.IDgenerator;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.Message;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.User;
import ${basePackage}.module.system.mpr.UserMapper;
import ${basePackage}.module.system.req.UserCreateRequest;
import ${basePackage}.module.system.req.UserDeleteRequest;
import ${basePackage}.module.system.req.UserFindRequest;
import ${basePackage}.module.system.req.UserGetRequest;
import ${basePackage}.module.system.req.UserUpdateRequest;
import ${basePackage}.module.system.rsp.UserCreateResponse;
import ${basePackage}.module.system.rsp.UserDeleteResponse;
import ${basePackage}.module.system.rsp.UserFindResponse;
import ${basePackage}.module.system.rsp.UserGetResponse;
import ${basePackage}.module.system.rsp.UserUpdateResponse;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import xyz.wbsite.frame.base.ErrorType;
import xyz.wbsite.frame.base.Token;
import xyz.wbsite.frame.utils.IDgenerator;
import xyz.wbsite.frame.utils.MapperUtil;
import xyz.wbsite.frame.utils.Message;
import xyz.wbsite.frame.utils.ValidationUtil;
import xyz.wbsite.module.system.ent.User;
import xyz.wbsite.module.system.mpr.UserMapper;
import xyz.wbsite.module.system.req.UserCreateRequest;
import xyz.wbsite.module.system.req.UserDeleteRequest;
import xyz.wbsite.module.system.req.UserFindRequest;
import xyz.wbsite.module.system.req.UserGetRequest;
import xyz.wbsite.module.system.req.UserRoleCreateRequest;
import xyz.wbsite.module.system.req.UserUpdateRequest;
import xyz.wbsite.module.system.rsp.UserCreateResponse;
import xyz.wbsite.module.system.rsp.UserDeleteResponse;
import xyz.wbsite.module.system.rsp.UserFindResponse;
import xyz.wbsite.module.system.rsp.UserGetResponse;
import xyz.wbsite.module.system.rsp.UserRoleCreateResponse;
import xyz.wbsite.module.system.rsp.UserUpdateResponse;
/**
* USER -
@ -38,6 +41,8 @@ public class UserManagerImpl implements UserManager {
@Autowired
private UserMapper userMapper;
@Autowired
private UserRoleManager userRoleManager;
/**
*
@ -63,6 +68,21 @@ public class UserManagerImpl implements UserManager {
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
return response;
}
for (Long aLong : request.getRoleIdList()) {
UserRoleCreateRequest userRoleCreateRequest = new UserRoleCreateRequest();
userRoleCreateRequest.setUserId(id);
userRoleCreateRequest.setUserCode(null);
userRoleCreateRequest.setRoleId(aLong);
userRoleCreateRequest.setRoleCode(null);
UserRoleCreateResponse userRoleCreateResponse = userRoleManager.create(userRoleCreateRequest, token);
if (userRoleCreateResponse.hasError()) {
response.addErrors(userRoleCreateResponse.getErrors());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return response;
}
}
response.setId(id);
return response;

@ -2,18 +2,20 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${basePackage}.module.system.mpr.UserRoleMapper">
<mapper namespace="xyz.wbsite.module.system.mpr.UserRoleMapper">
<sql id="table">`SYS_USER_ROLE`</sql>
<sql id="entityColumnList">
`ID`,`USER_ID`,`ROLE_ID`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
`ID`,`USER_ID`,`USER_CODE`,`ROLE_ID`,`ROLE_CODE`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
</sql>
<resultMap id="userRole" type="${basePackage}.module.system.ent.UserRole">
<resultMap id="userRole" type="xyz.wbsite.module.system.ent.UserRole">
<result column="ID" jdbcType="BIGINT" property="id"/>
<result column="USER_ID" jdbcType="BIGINT" property="userId"/>
<result column="USER_CODE" jdbcType="VARCHAR" property="userCode"/>
<result column="ROLE_ID" jdbcType="BIGINT" property="roleId"/>
<result column="ROLE_CODE" jdbcType="VARCHAR" property="roleCode"/>
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
@ -30,10 +32,16 @@
WHERE
`IS_DELETED` = 0
<if test="request.userId != null and request.userId != 0">
AND `USER_ID` = ${r"#"}{request.userId}
AND `USER_ID` = ${r'#'}{request.userId}
</if>
<if test="request.userCode != null and request.userCode != ''">
AND `USER_CODE` = ${r'#'}{request.userCode}
</if>
<if test="request.roleId != null and request.roleId != 0">
AND `ROLE_ID` = ${r"#"}{request.roleId}
AND `ROLE_ID` = ${r'#'}{request.roleId}
</if>
<if test="request.roleCode != null and request.roleCode != ''">
AND `ROLE_CODE` = ${r'#'}{request.roleCode}
</if>
</select>
@ -57,12 +65,14 @@
)
VALUES
(
${r"#"}{request.id},
${r"#"}{request.userId,jdbcType=BIGINT},
${r"#"}{request.roleId,jdbcType=BIGINT},
${r'#'}{request.id},
${r'#'}{request.userId,jdbcType=BIGINT},
${r'#'}{request.userCode,jdbcType=VARCHAR},
${r'#'}{request.roleId,jdbcType=BIGINT},
${r'#'}{request.roleCode,jdbcType=VARCHAR},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
${r'#'}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
@ -78,12 +88,14 @@
VALUES
<foreach collection="list" item= "item" index ="index" separator=",">
(
${r"#"}{item.id},
${r"#"}{item.userId,jdbcType=BIGINT},
${r"#"}{item.roleId,jdbcType=BIGINT},
${r'#'}{item.id},
${r'#'}{item.userId,jdbcType=BIGINT},
${r'#'}{item.userCode,jdbcType=VARCHAR},
${r'#'}{item.roleId,jdbcType=BIGINT},
${r'#'}{item.roleCode,jdbcType=VARCHAR},
0,
0,
${r"#"}{token.userId,jdbcType=NUMERIC},
${r'#'}{token.userId,jdbcType=NUMERIC},
sysdate(),
NULL,
NULL
@ -96,22 +108,24 @@
<include refid="table"/>
SET `IS_DELETED` = 1
WHERE `IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
AND `ID` = ${r'#'}{request.id}
</update>
<update id="update">
UPDATE
<include refid="table"/>
SET
`USER_ID` = ${r"#"}{request.userId,jdbcType=BIGINT},
`ROLE_ID` = ${r"#"}{request.roleId,jdbcType=BIGINT},
`USER_ID` = ${r'#'}{request.userId,jdbcType=BIGINT},
`USER_CODE` = ${r'#'}{request.userCode,jdbcType=VARCHAR},
`ROLE_ID` = ${r'#'}{request.roleId,jdbcType=BIGINT},
`ROLE_CODE` = ${r'#'}{request.roleCode,jdbcType=VARCHAR},
`ROW_VERSION` = `ROW_VERSION` + 1,
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
`LAST_UPDATE_BY` = ${r'#'}{token.userId},
`LAST_UPDATE_TIME` = sysdate()
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
AND `ID` = ${r'#'}{request.id}
AND `ROW_VERSION` = ${r'#'}{request.rowVersion}
</update>
<select id="get" resultMap="userRole">
@ -121,6 +135,6 @@
<include refid="table"/>
WHERE
`IS_DELETED` = 0
AND `ID` = ${r"#"}{request.id}
AND `ID` = ${r'#'}{request.id}
</select>
</mapper>

@ -1,11 +1,13 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty;
import org.hibernate.validator.constraints.Length;
import ${basePackage}.frame.base.BaseRequest;
import ${basePackage}.frame.validation.Dict;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* UserCreateRequest -
*
@ -56,6 +58,9 @@ public class UserCreateRequest extends BaseRequest {
@Length(min = 0, max = 50, message = "[deptCode]部门代码长度不合法(0-50)")
private String deptCode;
@NotEmpty(message = "[roleIdList]角色主键不能为空")
private List<Long> roleIdList;
public String getUserName() {
return this.userName;
}
@ -103,4 +108,12 @@ public class UserCreateRequest extends BaseRequest {
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public List<Long> getRoleIdList() {
return roleIdList;
}
public void setRoleIdList(List<Long> roleIdList) {
this.roleIdList = roleIdList;
}
}

@ -1,16 +1,17 @@
package ${basePackage}.module.system.req;
import org.hibernate.validator.constraints.Length;
import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;
/**
* UserRoleCreateRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
* @since 2020-01-08
*/
public class UserRoleCreateRequest extends BaseRequest {
@ -20,12 +21,26 @@ public class UserRoleCreateRequest extends BaseRequest {
@NotNull(message = "[userId]用户主键不能为NULL")
private Long userId;
/**
*
*/
// @NotEmpty(message = "[userCode]用户代码不能为空")
// @Length(min = 0, max = 50, message = "[userCode]用户代码长度不合法(0-50)")
private String userCode;
/**
*
*/
@NotNull(message = "[roleId]角色主键不能为NULL")
private Long roleId;
/**
*
*/
// @NotEmpty(message = "[roleCode]角色代码不能为空")
// @Length(min = 0, max = 50, message = "[roleCode]角色代码长度不合法(0-50)")
private String roleCode;
public Long getUserId() {
return this.userId;
}
@ -34,6 +49,14 @@ public class UserRoleCreateRequest extends BaseRequest {
this.userId = userId;
}
public String getUserCode() {
return this.userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public Long getRoleId() {
return this.roleId;
}
@ -41,4 +64,12 @@ public class UserRoleCreateRequest extends BaseRequest {
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
}

@ -1,6 +1,7 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull;
/**
@ -8,7 +9,7 @@ import javax.validation.constraints.NotNull;
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
* @since 2020-01-08
*/
public class UserRoleDeleteRequest extends BaseUpdateRequest {

@ -7,7 +7,7 @@ import ${basePackage}.frame.base.BaseFindRequest;
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
* @since 2020-01-08
*/
public class UserRoleFindRequest extends BaseFindRequest {
@ -16,11 +16,21 @@ public class UserRoleFindRequest extends BaseFindRequest {
*/
private Long userId;
/**
*
*/
private String userCode;
/**
*
*/
private Long roleId;
/**
*
*/
private String roleCode;
public Long getUserId() {
return this.userId;
}
@ -29,6 +39,14 @@ public class UserRoleFindRequest extends BaseFindRequest {
this.userId = userId;
}
public String getUserCode() {
return this.userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public Long getRoleId() {
return this.roleId;
}
@ -36,4 +54,12 @@ public class UserRoleFindRequest extends BaseFindRequest {
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
}

@ -1,6 +1,7 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull;
/**
@ -8,7 +9,7 @@ import javax.validation.constraints.NotNull;
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
* @since 2020-01-08
*/
public class UserRoleGetRequest extends BaseRequest {

@ -1,16 +1,17 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* UserRoleUpdateRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
* @since 2020-01-08
*/
public class UserRoleUpdateRequest extends BaseUpdateRequest {
@ -26,12 +27,26 @@ public class UserRoleUpdateRequest extends BaseUpdateRequest {
@NotNull(message = "[userId]用户主键不能为NULL")
private Long userId;
/**
*
*/
@NotEmpty(message = "[userCode]用户代码不能为空")
@Length(min = 0, max = 50, message = "[userCode]用户代码长度不合法(0-50)")
private String userCode;
/**
*
*/
@NotNull(message = "[roleId]角色主键不能为NULL")
private Long roleId;
/**
*
*/
@NotEmpty(message = "[roleCode]角色代码不能为空")
@Length(min = 0, max = 50, message = "[roleCode]角色代码长度不合法(0-50)")
private String roleCode;
public Long getId() {
return this.id;
}
@ -48,6 +63,14 @@ public class UserRoleUpdateRequest extends BaseUpdateRequest {
this.userId = userId;
}
public String getUserCode() {
return this.userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public Long getRoleId() {
return this.roleId;
}
@ -55,4 +78,12 @@ public class UserRoleUpdateRequest extends BaseUpdateRequest {
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
}

@ -1,17 +1,18 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import ${basePackage}.frame.base.BaseUpdateRequest;
import ${basePackage}.frame.validation.Dict;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* UserUpdateRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
* @since 2020-01-08
*/
public class UserUpdateRequest extends BaseUpdateRequest {
@ -55,12 +56,23 @@ public class UserUpdateRequest extends BaseUpdateRequest {
@Dict(name = "USER_STATUS")
private String userStatus;
/**
*
*/
private Long deptId;
/**
*
*/
@Length(min = 0, max = 50, message = "[deptCode]部门代码长度不合法(0-50)")
private String deptCode;
/**
*
*/
@Length(min = 0, max = 100, message = "[deptName]部门名称长度不合法(0-100)")
private String deptName;
public Long getId() {
return this.id;
}
@ -109,6 +121,14 @@ public class UserUpdateRequest extends BaseUpdateRequest {
this.userStatus = userStatus;
}
public Long getDeptId() {
return this.deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public String getDeptCode() {
return this.deptCode;
}
@ -116,4 +136,12 @@ public class UserUpdateRequest extends BaseUpdateRequest {
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public String getDeptName() {
return this.deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
}

@ -2,7 +2,7 @@
-- Table structure for DICT - 字典
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_DICT` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -23,7 +23,7 @@ PRIMARY KEY (`ID`)
-- Table structure for DICT_ITEM - 字典项
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_DICT_ITEM` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -45,7 +45,7 @@ PRIMARY KEY (`ID`)
-- Table structure for RES - 资源
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-05
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_RES` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -65,32 +65,11 @@ CREATE TABLE `SYS_RES` (
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源';
-- ----------------------------
-- Table structure for ROLE_RES - 角色资源关系
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-05
-- ----------------------------
CREATE TABLE `SYS_ROLE_RES` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`ROLE_ID` BIGINT(20) NOT NULL COMMENT '角色主键',
`ROLE_CODE` VARCHAR(50) NOT NULL COMMENT '角色代码',
`RES_ID` BIGINT(20) NOT NULL COMMENT '资源主键',
`RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
`CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
`LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户',
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色资源关系';
-- ----------------------------
-- Table structure for USER - 用户
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_USER` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -115,7 +94,7 @@ PRIMARY KEY (`ID`)
-- Table structure for DEPT - 部门
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_DEPT` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -138,7 +117,7 @@ PRIMARY KEY (`ID`)
-- Table structure for ROLE - 角色
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_ROLE` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -158,7 +137,7 @@ PRIMARY KEY (`ID`)
-- Table structure for TOKENS - 通行证
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_TOKENS` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -187,7 +166,7 @@ PRIMARY KEY (`ID`)
-- Table structure for FILE - 文件
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_FILE` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
@ -211,12 +190,14 @@ PRIMARY KEY (`ID`)
-- Table structure for USER_ROLE - 用户角色授权
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_USER_ROLE` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`USER_ID` BIGINT(20) NOT NULL COMMENT '用户主键',
`USER_CODE` VARCHAR(50) NOT NULL COMMENT '用户代码',
`ROLE_ID` BIGINT(20) NOT NULL COMMENT '角色主键',
`ROLE_CODE` VARCHAR(50) NOT NULL COMMENT '角色代码',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
@ -226,3 +207,24 @@ CREATE TABLE `SYS_USER_ROLE` (
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户角色授权';
-- ----------------------------
-- Table structure for ROLE_RES - 角色资源关系
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_ROLE_RES` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`ROLE_ID` BIGINT(20) NOT NULL COMMENT '角色主键',
`ROLE_CODE` VARCHAR(50) NOT NULL COMMENT '角色代码',
`RES_ID` BIGINT(20) NOT NULL COMMENT '资源主键',
`RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
`CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
`LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户',
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色资源关系';

@ -0,0 +1,22 @@
-- ----------------------------
-- Table structure for DEPT - 部门
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_DEPT` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`DEPT_CODE` VARCHAR(50) NOT NULL COMMENT '部门代码',
`DEPT_NAME` VARCHAR(100) NOT NULL COMMENT '部门名称',
`DEPT_ALIAS` VARCHAR(50) COMMENT '部门别名',
`SUP_CODE` VARCHAR(50) COMMENT '上级代码',
`SUP_NAME` VARCHAR(100) COMMENT '上级名称',
`VALID` TINYINT(1) NOT NULL COMMENT '是否有效',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
`CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
`LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户',
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门';

@ -0,0 +1,24 @@
-- ----------------------------
-- Table structure for USER - 用户
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_USER` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`USER_NAME` VARCHAR(100) NOT NULL COMMENT '用户账户',
`USER_CODE` VARCHAR(50) NOT NULL COMMENT '用户代码',
`USER_ALIAS` VARCHAR(50) COMMENT '用户别名',
`USER_PWD` VARCHAR(50) NOT NULL COMMENT '用户密码',
`USER_STATUS` VARCHAR(20) NOT NULL COMMENT '用户状态',
`DEPT_ID` BIGINT(20) COMMENT '部门主键',
`DEPT_CODE` VARCHAR(50) COMMENT '部门代码',
`DEPT_NAME` VARCHAR(100) COMMENT '部门名称',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
`CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
`LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户',
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户';

@ -0,0 +1,20 @@
-- ----------------------------
-- Table structure for USER_ROLE - 用户角色授权
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-08
-- ----------------------------
CREATE TABLE `SYS_USER_ROLE` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`USER_ID` BIGINT(20) NOT NULL COMMENT '用户主键',
`USER_CODE` VARCHAR(50) NOT NULL COMMENT '用户代码',
`ROLE_ID` BIGINT(20) NOT NULL COMMENT '角色主键',
`ROLE_CODE` VARCHAR(50) NOT NULL COMMENT '角色代码',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
`CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
`LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户',
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户角色授权';

@ -156,7 +156,9 @@
<fields>
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="用户主键" fieldLength="0" fieldName="USER_ID" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="用户代码" fieldLength="50" fieldName="USER_CODE" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="角色主键" fieldLength="0" fieldName="ROLE_ID" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="角色代码" fieldLength="50" fieldName="ROLE_CODE" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="行版本" fieldLength="0" fieldName="ROW_VERSION" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="0" fieldComment="是否已删除" fieldLength="0" fieldName="IS_DELETED" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="创建用户" fieldLength="0" fieldName="CREATE_BY" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>

@ -723,4 +723,12 @@ code {
min-height: 23px;
}
.el-transfer__buttons .el-transfer__button {
display: block;
padding: 10px;
border-radius: 50%;
margin-left: 5px;
color: #C0C4CC;
}
/* 以上为APP样式 */

File diff suppressed because one or more lines are too long

@ -85,7 +85,7 @@
width="80"
label="是否有效">
<template slot-scope="scope">
<el-tag size="mini" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template>
</el-table-column>

@ -72,7 +72,7 @@
width="80"
label="是否有效">
<template slot-scope="scope">
<el-tag size="mini" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template>
</el-table-column>

@ -75,7 +75,7 @@
width="80"
label="是否有效">
<template slot-scope="scope">
<el-tag size="mini" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template>
</el-table-column>

@ -81,7 +81,7 @@
label="是否有效"
width="80">
<template slot-scope="scope">
<el-tag size="mini" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template>
</el-table-column>

@ -86,7 +86,7 @@
prop="valid"
label="是否有效">
<template slot-scope="scope">
<el-tag size="mini" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="success" v-if="scope.row.valid">有效</el-tag>
<el-tag size="mini" type="danger" v-if="!scope.row.valid">无效</el-tag>
</template>
</el-table-column>

@ -15,7 +15,7 @@
<el-input-dict v-model="vm.userStatus" clearable size="small" placeholder="请输入用户状态" dict-name="USER_STATUS"></el-input-dict>
</el-form-item>
<el-form-item label="所属部门" prop="deptCode">
<el-input-dept v-model="vm.deptCode" clearable size="small" placeholder="请选择所属部门" ></el-input-dept>
<el-input-dept v-model="vm.deptCode" clearable size="small" placeholder="请选择所属部门"></el-input-dept>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="onSearch">搜索</el-button>
@ -147,16 +147,22 @@
<el-input v-model="form.userCode" clearable size="small" placeholder="请输入用户代码"></el-input>
</el-form-item>
<el-form-item label="用户别名" prop="userAlias">
<el-input v-model="form.userAlias" clearable size="small" placeholder="请输入用户别名"></el-input>
<el-input v-model="form.userAlias" clearable size="small" autocomplete="off" placeholder="请输入用户别名"></el-input>
</el-form-item>
<el-form-item label="用户状态" prop="userStatus">
<el-input-dict v-model="form.userStatus" clearable size="small" placeholder="请输入用户状态" dict-name="USER_STATUS"></el-input-dict>
<el-form-item label="用户密码" prop="userPwd">
<el-input v-model="form.userPwd" type="password" clearable size="small" autocomplete="off" placeholder="请输入用户密码"></el-input>
</el-form-item>
<el-form-item label="所属部门" prop="deptCode">
<el-input-dept v-model="form.deptCode" clearable size="small" placeholder="请选择所属部门" ></el-input-dept>
<el-input-dept v-model="form.deptCode" clearable size="small" placeholder="请选择所属部门"></el-input-dept>
</el-form-item>
<el-form-item label="确认密码" prop="userPwd_">
<el-input v-model="form.userPwd_" type="password" clearable size="small" autocomplete="off" placeholder="请输入用户确认密码"></el-input>
</el-form-item>
<el-form-item label="用户状态" prop="userStatus">
<el-input-dict v-model="form.userStatus" clearable size="small" placeholder="请输入用户状态" dict-name="USER_STATUS"></el-input-dict>
</el-form-item>
<el-form-item label="用户角色" prop="roleList">
<el-transfer v-model="form.roleList" :data="roleList" :titles="['未选角色','已选角色']"></el-transfer>
<el-form-item label="用户角色" prop="roleIdList">
<el-transfer v-model="form.roleIdList" :data="roleList" :titles="['未选角色','已选角色']"></el-transfer>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@ -192,8 +198,10 @@
userCode: "",
userAlias: "",
userPwd: "",
userPwd_: "",
userStatus: "1",
deptCode: "",
roleIdList: [],
rowVersion: ""
},
formRules: {
@ -210,13 +218,41 @@
],
userPwd: [
{required: true, message: '用户密码不能为空', trigger: 'blur'},
{min: 1, max: 50, message: '用户密码长度在 1 到 50 个字符', trigger: 'blur'}
{
validator: function (rule, value, callback) {
if (value === '') {
callback(new Error('请输入密码'));
} else {
if (app.form.userPwd_ !== '') {
app.$refs.form.validateField('userPwd_');
}
callback();
}
}, trigger: 'blur'
}
],
userPwd_: [
{required: true, message: '用户确认密码不能为空', trigger: 'blur'},
{
validator: function (rule, value, callback) {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== app.form.userPwd) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
}, trigger: 'blur'
}
],
userStatus: [
{required: true, message: '用户状态不能为空', trigger: 'blur'},
],
deptCode: [
{min: 1, max: 50, message: '部门代码长度在 1 到 50 个字符', trigger: 'blur'}
],
roleIdList: [
{required: true, message: '用户角色不能为空', trigger: 'blur'},
]
},
roleList: []

Loading…
Cancel
Save

Powered by TurnKey Linux.