Commit df027daf authored by hongguangwu's avatar hongguangwu

优化

parent 9434f9e8
......@@ -116,10 +116,10 @@
<delete id="deleteByUserIdAndHuName">
delete from t_socialfund_house_res where USER_ID = #{tSocialfundHouseRes.userId} and AUTH_TYPE = #{tSocialfundHouseRes.authType}
<if test="tSocialfundHouseRes.socialHousehold != null and tSocialfundHouseRes.socialHousehold.trim() != ''">
AND a.SOCIAL_HOUSEHOLD = #{tSocialfundHouseRes.socialHousehold}
AND SOCIAL_HOUSEHOLD = #{tSocialfundHouseRes.socialHousehold}
</if>
<if test="tSocialfundHouseRes.fundHousehold != null and tSocialfundHouseRes.fundHousehold.trim() != ''">
AND a.FUND_HOUSEHOLD = #{tSocialfundHouseRes.fundHousehold}
AND FUND_HOUSEHOLD = #{tSocialfundHouseRes.fundHousehold}
</if>
<if test="tSocialfundHouseRes.socialHousehold == null and tSocialfundHouseRes.fundHousehold == null">
AND 1=2
......
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @author hgw
* @date 2022-12-7 10:46:38
*/
@Data
public class UserPasswordVo {
@Schema(description = "用户id")
private String userId;
@Schema(description = "用户登录名")
private String userName;
@Schema(description = "原密码")
private String oldPassword;
@Schema(description = "新密码")
private String newPassword;
}
......@@ -173,6 +173,17 @@ public class UserController {
return R.ok(userService.updateUser(userDto));
}
/**
* 修改密码
* @param vo 用户信息
* @return R
*/
@SysLog("修改密码")
@PostMapping("/updatePassword")
public R<String> updatePassword(@RequestBody UserPasswordVo vo) {
return userService.updatePassword(vo);
}
/**
* 分页查询用户
* @param page 参数集
......
......@@ -23,6 +23,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserDTO;
import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserPasswordVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
......@@ -73,6 +74,15 @@ public interface SysUserService extends IService<SysUser> {
*/
Boolean updateUser(UserDTO userDto);
/**
* @param vo
* @Description: 修改密码
* @Author: hgw
* @Date: 2022/12/7 10:48
* @return: java.lang.Boolean
**/
R<String> updatePassword(UserPasswordVo vo);
/**
* 通过ID查询用户信息
* @param id 用户ID
......
......@@ -31,6 +31,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.*;
import com.yifu.cloud.plus.v1.yifu.admin.api.util.ParamResolver;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserPasswordVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.*;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysMenuService;
......@@ -242,6 +243,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
@CacheEvict(value = CacheConstants.USER_DETAILS, key = "#vo.userName")
public R<String> updatePassword(UserPasswordVo vo) {
SysUser sysUser = this.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUserId, vo.getUserId()));
if (ENCODER.encode(vo.getOldPassword()).equals(sysUser.getPassword())) {
sysUser.setPassword(ENCODER.encode(vo.getNewPassword()));
} else {
return R.failed("原密码错误");
}
this.updateById(sysUser);
return R.ok();
}
/**
* 查询上级部门的用户信息
* @param username 用户名
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment