肖潇晓枭逍 2019-05-08 15:26 采纳率: 100%
浏览 880
已采纳

求助,ssm框架insert语句接收不到pojo类的数据什么问题

这是前端输入的数据
图片说明

前端AJAX传入数据

图片说明

后台Controller层代码
图片说明

service层
图片说明

sql输出语句表示这两层都能接受数据
图片说明
但是插入语句找不到数据

==>  Preparing: insert into staff(id,sname,sex,birthday,sid,depart_id,post_id,entrydate,joinworkdate,workform, ,staffsource,politicalstatus,nation,nativeplace,stel,semail,sheight,bloodtype,maritalstatus, registeredresidence,education,degree,university,major,graduationdate,startdate,enddate,status,peroidopdate) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,? ,'正常' ,?) 

下面是Dao层代码

@Repository("staffDao")
@Mapper
public interface StaffDao {

    public int addStaff(Staff staff);
}

mybatis-conf.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
     <mappers>
        <mapper resource="com/mybatis/AdminMapper.xml"/>
        <mapper resource="com/mybatis/DepartmentMapper.xml"/>
        <mapper resource="com/mybatis/PostMapper.xml"/>
        <mapper resource="com/mybatis/StaffMapper.xml"/>
    </mappers>
</configuration>

StaffMapper.xml代码如下图片说明

数据库结构
图片说明

Staff类

public class Staff {
    private Integer id;
    private String sname;
    private String sex;
    private Date birthday;
    private String birthday1;
    private String sid;
    private Integer depart_id;
    private Integer post_id;
    private Date entrydate;
    private String entrydate1;
    private Date joinworkdate;
    private String joinworkdate1;
    private String workform;
    private String staffsource;
    private String politicalstatus;
    private String nation;
    private String nativeplace;
    private String stel;
    private String semail;
    private Double sheight;
    private String bloodtype;
    private String maritalstatus;
    private String registeredresidence;
    private String education;
    private String degree;
    private String university;
    private String major;
    private Date graduationdate;
    private String graduationdate1;
    private Date startdate;
    private String startdate1;
    private Date enddate;
    private String enddate1;
    private String status;
    private String dname;
    private String pname;
    //get和set省略
}
  • 写回答

6条回答 默认 最新

  • 肖潇晓枭逍 2019-05-08 23:36
    关注

    感谢各位,解决了,实体类中少了一个字段

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥15 QT6颜色选择对话框显示不完整
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥15 DS18B20内部ADC模数转换器