为什么我的controller拿到的password是null啊,更新操作除了password都更改了,因为password是null
Controller
ServiceImpl
dao
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表