汪的爱琪 2024-01-31 15:24 采纳率: 67.5%
浏览 3
已结题

SpringBoot

为什么我的controller拿到的password是null啊,更新操作除了password都更改了,因为password是null
Controller

img


ServiceImpl

img


dao

img


POJO类

package com.codecart.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.util.Date;

@Data
public class User {
    private Integer id;
    private String name;
    private String username;
    @JsonIgnore
    private String password;
    private char gender;
    private byte age;
    private String address;
    private String email;
    private String registration_time;
    private String last_login_time;
    private UserStatus user_status;
    private UserType user_type;
    private String phone_number;
    private String birthday;
    private String education;
}


xml配置文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.codecart.mapper.UserMapper">
    <insert id="register" parameterType="user">
            insert into user(username,password,registration_time) values(#{username},#{password},#{registerTime})
    </insert>
    <select id="getUserByUsername" parameterType="java.lang.String" resultType="user">
        select * from user where username = #{username}
    </select>
    <update id="update" parameterType="user">
        update user
        <set>
            <if test="name!=null and name!= ''">name = #{name},</if>
            <if test="password!=null and password!= ''">password = #{password},</if>
            <if test="gender!=null and gender!= ''">gender = #{gender},</if>
            <if test="age!=null and age!= ''">age = #{age},</if>
            <if test="address!=null and address!= ''">address = #{address},</if>
            <if test="email!=null and email!= ''">email = #{email},</if>
            <if test="phone_number!=null and phone_number!= ''">phone_number = #{phone_number},</if>
            <if test="birthday!=null and birthday!= ''">birthday = #{birthday},</if>
            <if test="education!=null and education!= ''">education = #{education},</if>
        </set>
        where id = #{id}
    </update>
</mapper>


User表

img

  • 写回答

4条回答 默认 最新

  • zcl_1991 2024-01-31 16:37
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 2月10日
  • 已采纳回答 2月2日
  • 创建了问题 1月31日

悬赏问题

  • ¥15 有人会用py或者r画这种图吗
  • ¥15 MOD04_3K图像预处理
  • ¥15 [VASP]关于超胞大小和k 点网格的收敛性测试
  • ¥15 pip下载paddle2onnx离谱错误
  • ¥60 db2move nlzxams import 导出db2备份数据报错
  • ¥15 关于#python#的问题:全文总结功能咨询
  • ¥15 俄罗斯方块中无法同时消除多个满行
  • ¥15 使用gojs3.0,如何在nodeDataArray设置好text的位置,再go.TextBlock alignment中进行相应的改变
  • ¥15 psfusion图像融合指标很低
  • ¥15 银河麒麟linux系统如何修改/etc/hosts权限为777