| | |
| | | /** 密码 */ |
| | | private String password; |
| | | |
| | | /** 操作密码 */ |
| | | @ApiModelProperty(value = "操作密码") |
| | | @TableField("operation_password") |
| | | private String operationPassword; |
| | | |
| | | /** 帐号状态(0正常 1停用) */ |
| | | @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getOperationPassword() |
| | | { |
| | | return operationPassword; |
| | | } |
| | | |
| | | public void setOperationPassword(String operationPassword) |
| | | { |
| | | this.operationPassword = operationPassword; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | return status; |
| | |
| | | .append("sex", getSex()) |
| | | .append("avatar", getAvatar()) |
| | | .append("password", getPassword()) |
| | | .append("operationPassword", getOperationPassword()) |
| | | .append("status", getStatus()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("loginIp", getLoginIp()) |
| | |
| | | /** |
| | | * 排除敏感属性字段 |
| | | */ |
| | | public static final String[] EXCLUDE_PROPERTIES = {"password", "oldPassword", "newPassword", "confirmPassword"}; |
| | | public static final String[] EXCLUDE_PROPERTIES = {"password", "operationPassword", "oldPassword", "newPassword", "confirmPassword"}; |
| | | |
| | | /** |
| | | * 计算操作消耗时间 |
| | |
| | | return toAjax(result); |
| | | } |
| | | |
| | | /** |
| | | * 重置操作密码 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/reset_passwords"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetOperationPwd") |
| | | @ApiOperation(value = "重置操作密码", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult resetOperationPwd(@RequestBody Map<String, Object> params) { |
| | | Long userId = parseLong(params.get("userId")); |
| | | if (userId == null) { |
| | | return AjaxResult.error("用户不存在"); |
| | | } |
| | | |
| | | SysUser user = userService.selectUserById(userId); |
| | | if (user == null) { |
| | | return AjaxResult.error("用户不存在"); |
| | | } |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(userId); |
| | | |
| | | user.setOperationPassword(SecurityUtils.encryptPassword("123456")); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(userService.updateUser(user)); |
| | | } |
| | | private Long parseLong(Object value) { |
| | | if (value == null || StringUtils.isEmpty(String.valueOf(value))) { |
| | | return null; |
| | |
| | | @Service |
| | | public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService { |
| | | private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); |
| | | private static final String DEFAULT_OPERATION_PASSWORD = "123456"; |
| | | |
| | | @Resource |
| | | private SysUserMapper userMapper; |
| | |
| | | user.setCreateBy(tokenService.getLoginUser().getUsername()); |
| | | user.setUpdateTime(new Date()); |
| | | user.setUpdateBy(tokenService.getLoginUser().getUsername()); |
| | | if (StringUtils.isEmpty(user.getOperationPassword())) { |
| | | user.setOperationPassword(SecurityUtils.encryptPassword(DEFAULT_OPERATION_PASSWORD)); |
| | | } |
| | | return userMapper.insert(user); |
| | | } |
| | | |
| | |
| | | <result property="sex" column="sex" /> |
| | | <result property="avatar" column="avatar" /> |
| | | <result property="password" column="password" /> |
| | | <result property="operationPassword" column="operation_password" /> |
| | | <result property="status" column="status" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="loginIp" column="login_ip" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.passWordUpdate, |
| | | select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.operation_password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.passWordUpdate, |
| | | d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, |
| | | r.role_id, r.role_name, r.role_key, r.data_scope, r.status as role_status ,u.roleType as roleType,u.objectId AS objectId |
| | | from sys_user u |
| | |
| | | </sql> |
| | | |
| | | <select id="selectUserList" parameterType="com.ruoyi.system.api.domain.SysUser" resultMap="SysUserResult"> |
| | | select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.passWordUpdate, d.dept_name, d.leader from sys_user u |
| | | select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.operation_password, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.passWordUpdate, d.dept_name, d.leader from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | where u.del_flag = '0' |
| | | <if test="phonenumber != null and phonenumber != ''"> |
| | |
| | | <if test="phonenumber != null and phonenumber != ''">phonenumber,</if> |
| | | <if test="sex != null and sex != ''">sex,</if> |
| | | <if test="password != null and password != ''">password,</if> |
| | | <if test="operationPassword != null and operationPassword != ''">operation_password,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="roleType != null and roleType != ''">roleType,</if> |
| | |
| | | <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if> |
| | | <if test="sex != null and sex != ''">#{sex},</if> |
| | | <if test="password != null and password != ''">#{password},</if> |
| | | <if test="operationPassword != null and operationPassword != ''">#{operationPassword},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="roleType != null and roleType != ''">#{roleType},</if> |
| | |
| | | <if test="sex != null and sex != ''">sex = #{sex},</if> |
| | | <if test="avatar != null and avatar != ''">avatar = #{avatar},</if> |
| | | <if test="password != null and password != ''">password = #{password},</if> |
| | | <if test="operationPassword != null and operationPassword != ''">operation_password = #{operationPassword},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if> |
| | | <if test="loginDate != null">login_date = #{loginDate},</if> |
| New file |
| | |
| | | -- 系统用户操作密码:默认 123456 |
| | | ALTER TABLE `sys_user` |
| | | ADD COLUMN `operation_password` varchar(100) NULL DEFAULT NULL COMMENT '操作密码' AFTER `password`; |
| | | |
| | | UPDATE `sys_user` |
| | | SET `operation_password` = '$2a$10$7QeU7kvS./.j/mwU1YJ.X.1.3DDoM457DedVOOGd2izyrQfJyW2i2' |
| | | WHERE `operation_password` IS NULL OR `operation_password` = ''; |