weixin_44876820
肖潇晓枭逍
2019-05-08 15:26

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

  • spring
  • java
  • xml
  • eclipse

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

前端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条回答

为你推荐