wuzeyu
2024-07-04 cac5a8bd1746e30e8506a729aecb8feed6f0698a
user模块 重构重置密码接口
5个文件已修改
33 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaUserMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoBa.BaUser;
import com.dy.pipIrrGlobal.pojoPr.PrController;
import com.dy.pipIrrGlobal.voBa.VoUserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -12,6 +13,8 @@
@Mapper
public interface BaUserMapper extends BaseMapper<BaUser> {
    BaUser selectByPrimaryKey(Long id);
    /**
     * 用户登录
     * @param phone 手机号
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
@@ -343,4 +343,12 @@
        WHERE userId = ${userId}
    </select>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        <!--@mbg.generated-->
        select
        <include refid="Base_Column_List" />
        from ba_user
        where id = #{id,jdbcType=BIGINT}
    </select>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java
@@ -43,7 +43,7 @@
    @Value("${user.defaultTrueRandomFalsePassword:true}")
    private Boolean defaultTrueRandomFalsePassword;
    @Value("${user.defaultPassword:ABC123}")
    @Value("${user.defaultPassword:abc_123}")
    private String defaultPassword;
    @Autowired
@@ -285,7 +285,7 @@
    /**
     * 重置密码
     * @param vo form表单对象
     * @param
     * @return 是否成功
     */
    @Operation(summary = "重置密码", description = "提交数据(form表单json数据),进行密码重置")
@@ -297,21 +297,21 @@
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "resetPassword", consumes = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(path = "resetPassword")
    @SsoAop()
    public BaseResponse<Boolean> resetPassword(@RequestBody  ResetPasswordVo vo) throws Exception {
        if (vo.id == null) {
    public BaseResponse<Boolean> resetPassword(String id) throws Exception {
        if (id == null || id == "") {
            return BaseResponseUtils.buildFail("id不能为空");
        }
        String password = MD5.encrypt(vo.password);//进行加密码
        Long idLg = Long.parseLong(vo.id);
        Long idLg = Long.parseLong(id);
        int count;
        try {
            BaUser po = this.sv.selectById(idLg);
            if (Objects.isNull(po)) {
                return BaseResponseUtils.buildFail("未得到用户,请求失败");
            } else {
                count = this.sv.changePassword(idLg, password);
            }else {
                String defaultPassword1 = MD5.encrypt(defaultPassword);//进行加密码
                count = this.sv.changePassword(idLg, defaultPassword1);
            }
        } catch (Exception e) {
            log.error("保存用户异常", e);
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java
@@ -50,7 +50,7 @@
     * @return 用户实体
     */
    public BaUser selectById(Long id) {
        return this.dao.selectById(id);
        return this.dao.selectByPrimaryKey(id);
    }
    /**
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/resources/application.yml
@@ -3,7 +3,7 @@
        include: global, database, database-ym, database-pj
user:
    defaultTrueRandomFalsePassword: true #true:采用默认密码,false:系统产生随机密码
    defaultPassword: "ABC123"
    defaultPassword: "abc_123"
#actutor的web端口
management: