尝试根据添加用户与填写报销单模块编写添加人员信息模块,出现如下问题

尝试根据添加用户与填写报销单模块编写添加人员信息模块,出现如下问题

项目目录结构如下:

http://img1.sycdn.imooc.com//climg/5b29afa30001002603710688.jpg

http://img1.sycdn.imooc.com//climg/5b29afa300016b1903390865.jpg

http://img1.sycdn.imooc.com//climg/5b29afa300018ee303620583.jpg

其中实体类源码如下:

package com.ims.info.entity;

import java.util.Date;

public class Person {
   private String sn;

   private String name;

   private String sex;

   private String nation;

   private Date birthdate;

   private String idcard;

   private String martial;

   private String political;

   private String education;

   private String household;

   private String domicile;

   private String htelephone;

   private String address;

   private String telephone;

   private String email;

   private String jobtitle;

   private String workingyears;

   private String contact;

   private String ctelephone;

   private String finalunit;

   private String remark;

   private Date estartTime;

   private Date efinalTime;

   private String sname;

   private String college;

   private String major;

   private String overseas;

   private Date wstartTime;

   private Date wfinalTime;

   private String uname;

   private String post;

   private String uaddress;

   private String credential;

   private String rank;

   private String gettime;

   private String appellation;

   private String rname;

   private String runit;

   private String raddress;

   public String getSn() {
       return sn;
   }

   public void setSn(String sn) {
       this.sn = sn == null ? null : sn.trim();
   }

   public String getName() {
       return name;
   }

   public void setName(String name) {
       this.name = name == null ? null : name.trim();
   }

   public String getSex() {
       return sex;
   }

   public void setSex(String sex) {
       this.sex = sex == null ? null : sex.trim();
   }

   public String getNation() {
       return nation;
   }

   public void setNation(String nation) {
       this.nation = nation == null ? null : nation.trim();
   }

   public Date getBirthdate() {
       return birthdate;
   }

   public void setBirthdate(Date birthdate) {
       this.birthdate = birthdate;
   }

   public String getIdcard() {
       return idcard;
   }

   public void setIdcard(String idcard) {
       this.idcard = idcard == null ? null : idcard.trim();
   }

   public String getMartial() {
       return martial;
   }

   public void setMartial(String martial) {
       this.martial = martial == null ? null : martial.trim();
   }

   public String getPolitical() {
       return political;
   }

   public void setPolitical(String political) {
       this.political = political == null ? null : political.trim();
   }

   public String getEducation() {
       return education;
   }

   public void setEducation(String education) {
       this.education = education == null ? null : education.trim();
   }

   public String getHousehold() {
       return household;
   }

   public void setHousehold(String household) {
       this.household = household == null ? null : household.trim();
   }

   public String getDomicile() {
       return domicile;
   }

   public void setDomicile(String domicile) {
       this.domicile = domicile == null ? null : domicile.trim();
   }

   public String getHtelephone() {
       return htelephone;
   }

   public void setHtelephone(String htelephone) {
       this.htelephone = htelephone == null ? null : htelephone.trim();
   }

   public String getAddress() {
       return address;
   }

   public void setAddress(String address) {
       this.address = address == null ? null : address.trim();
   }

   public String getTelephone() {
       return telephone;
   }

   public void setTelephone(String telephone) {
       this.telephone = telephone == null ? null : telephone.trim();
   }

   public String getEmail() {
       return email;
   }

   public void setEmail(String email) {
       this.email = email == null ? null : email.trim();
   }

   public String getJobtitle() {
       return jobtitle;
   }

   public void setJobtitle(String jobtitle) {
       this.jobtitle = jobtitle == null ? null : jobtitle.trim();
   }

   public String getWorkingyears() {
       return workingyears;
   }

   public void setWorkingyears(String workingyears) {
       this.workingyears = workingyears == null ? null : workingyears.trim();
   }

   public String getContact() {
       return contact;
   }

   public void setContact(String contact) {
       this.contact = contact == null ? null : contact.trim();
   }

   public String getCtelephone() {
       return ctelephone;
   }

   public void setCtelephone(String ctelephone) {
       this.ctelephone = ctelephone == null ? null : ctelephone.trim();
   }

   public String getFinalunit() {
       return finalunit;
   }

   public void setFinalunit(String finalunit) {
       this.finalunit = finalunit == null ? null : finalunit.trim();
   }

   public String getRemark() {
       return remark;
   }

   public void setRemark(String remark) {
       this.remark = remark == null ? null : remark.trim();
   }

   public Date getEstartTime() {
       return estartTime;
   }

   public void setEstartTime(Date estartTime) {
       this.estartTime = estartTime;
   }

   public Date getEfinalTime() {
       return efinalTime;
   }

   public void setEfinalTime(Date efinalTime) {
       this.efinalTime = efinalTime;
   }

   public String getSname() {
       return sname;
   }

   public void setSname(String sname) {
       this.sname = sname == null ? null : sname.trim();
   }

   public String getCollege() {
       return college;
   }

   public void setCollege(String college) {
       this.college = college == null ? null : college.trim();
   }

   public String getMajor() {
       return major;
   }

   public void setMajor(String major) {
       this.major = major == null ? null : major.trim();
   }

   public String getOverseas() {
       return overseas;
   }

   public void setOverseas(String overseas) {
       this.overseas = overseas == null ? null : overseas.trim();
   }

   public Date getWstartTime() {
       return wstartTime;
   }

   public void setWstartTime(Date wstartTime) {
       this.wstartTime = wstartTime;
   }

   public Date getWfinalTime() {
       return wfinalTime;
   }

   public void setWfinalTime(Date wfinalTime) {
       this.wfinalTime = wfinalTime;
   }

   public String getUname() {
       return uname;
   }

   public void setUname(String uname) {
       this.uname = uname == null ? null : uname.trim();
   }

   public String getPost() {
       return post;
   }

   public void setPost(String post) {
       this.post = post == null ? null : post.trim();
   }

   public String getUaddress() {
       return uaddress;
   }

   public void setUaddress(String uaddress) {
       this.uaddress = uaddress == null ? null : uaddress.trim();
   }

   public String getCredential() {
       return credential;
   }

   public void setCredential(String credential) {
       this.credential = credential == null ? null : credential.trim();
   }

   public String getRank() {
       return rank;
   }

   public void setRank(String rank) {
       this.rank = rank == null ? null : rank.trim();
   }

   public String getGettime() {
       return gettime;
   }

   public void setGettime(String gettime) {
       this.gettime = gettime == null ? null : gettime.trim();
   }

   public String getAppellation() {
       return appellation;
   }

   public void setAppellation(String appellation) {
       this.appellation = appellation == null ? null : appellation.trim();
   }

   public String getRname() {
       return rname;
   }

   public void setRname(String rname) {
       this.rname = rname == null ? null : rname.trim();
   }

   public String getRunit() {
       return runit;
   }

   public void setRunit(String runit) {
       this.runit = runit == null ? null : runit.trim();
   }

   public String getRaddress() {
       return raddress;
   }

   public void setRaddress(String raddress) {
       this.raddress = raddress == null ? null : raddress.trim();
   }
}

Dao类文件源码如下:

package com.ims.info.dao;

import com.ims.info.entity.Person;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("PersonMapper")
public interface PersonMapper {
   int deleteByPrimaryKey(String sn);

   int insert(Person record);

   int insertSelective(Person record);

   Person selectByPrimaryKey(String sn);

   int updateByPrimaryKeySelective(Person record);

   int updateByPrimaryKey(Person record);

   List<Person> selectAll();
}

Dao.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.ims.info.dao.PersonMapper" >
 <resultMap id="BaseResultMap" type="com.ims.info.entity.Person" >
   <id column="sn" property="sn" jdbcType="CHAR" />
   <result column="name" property="name" jdbcType="VARCHAR" />
   <result column="sex" property="sex" jdbcType="VARCHAR" />
   <result column="nation" property="nation" jdbcType="VARCHAR" />
   <result column="birthdate" property="birthdate" jdbcType="DATE" />
   <result column="IDcard" property="idcard" jdbcType="VARCHAR" />
   <result column="martial" property="martial" jdbcType="VARCHAR" />
   <result column="political" property="political" jdbcType="VARCHAR" />
   <result column="education" property="education" jdbcType="VARCHAR" />
   <result column="household" property="household" jdbcType="VARCHAR" />
   <result column="domicile" property="domicile" jdbcType="VARCHAR" />
   <result column="htelephone" property="htelephone" jdbcType="VARCHAR" />
   <result column="address" property="address" jdbcType="VARCHAR" />
   <result column="telephone" property="telephone" jdbcType="VARCHAR" />
   <result column="email" property="email" jdbcType="VARCHAR" />
   <result column="jobtitle" property="jobtitle" jdbcType="VARCHAR" />
   <result column="workingyears" property="workingyears" jdbcType="VARCHAR" />
   <result column="contact" property="contact" jdbcType="VARCHAR" />
   <result column="ctelephone" property="ctelephone" jdbcType="VARCHAR" />
   <result column="finalunit" property="finalunit" jdbcType="VARCHAR" />
   <result column="remark" property="remark" jdbcType="VARCHAR" />
   <result column="estart_time" property="estartTime" jdbcType="DATE" />
   <result column="efinal_time" property="efinalTime" jdbcType="DATE" />
   <result column="sname" property="sname" jdbcType="VARCHAR" />
   <result column="college" property="college" jdbcType="VARCHAR" />
   <result column="major" property="major" jdbcType="VARCHAR" />
   <result column="overseas" property="overseas" jdbcType="VARCHAR" />
   <result column="wstart_time" property="wstartTime" jdbcType="DATE" />
   <result column="wfinal_time" property="wfinalTime" jdbcType="DATE" />
   <result column="uname" property="uname" jdbcType="VARCHAR" />
   <result column="post" property="post" jdbcType="VARCHAR" />
   <result column="uaddress" property="uaddress" jdbcType="VARCHAR" />
   <result column="credential" property="credential" jdbcType="VARCHAR" />
   <result column="rank" property="rank" jdbcType="VARCHAR" />
   <result column="gettime" property="gettime" jdbcType="VARCHAR" />
   <result column="appellation" property="appellation" jdbcType="VARCHAR" />
   <result column="rname" property="rname" jdbcType="VARCHAR" />
   <result column="runit" property="runit" jdbcType="VARCHAR" />
   <result column="raddress" property="raddress" jdbcType="VARCHAR" />
 </resultMap>
 <sql id="Base_Column_List" >
   sn, name, sex, nation, birthdate, IDcard, martial, political, education, household,
   domicile, htelephone, address, telephone, email, jobtitle, workingyears, contact,
   ctelephone, finalunit, remark, estart_time, efinal_time, sname, college, major, overseas,
   wstart_time, wfinal_time, uname, post, uaddress, credential, rank, gettime, appellation,
   rname, runit, raddress
 </sql>
 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
   select
   <include refid="Base_Column_List" />
   from person
   where sn = #{sn,jdbcType=CHAR}
 </select>
 <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
   delete from person
   where sn = #{sn,jdbcType=CHAR}
 </delete>
 <insert id="insert" parameterType="com.ims.info.entity.Person" >
   insert into person (sn, name, sex, nation,
     birthdate, IDcard, martial,
     political, education, household,
     domicile, htelephone, address,
     telephone, email, jobtitle,
     workingyears, contact, ctelephone,
     finalunit, remark, estart_time,
     efinal_time, sname, college,
     major, overseas, wstart_time,
     wfinal_time, uname, post,
     uaddress, credential, rank,
     gettime, appellation, rname,
     runit, raddress)
   values (#{sn,jdbcType=CHAR}, #{name,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{nation,jdbcType=VARCHAR},
     #{birthdate,jdbcType=DATE}, #{idcard,jdbcType=VARCHAR}, #{martial,jdbcType=VARCHAR},
     #{political,jdbcType=VARCHAR}, #{education,jdbcType=VARCHAR}, #{household,jdbcType=VARCHAR},
     #{domicile,jdbcType=VARCHAR}, #{htelephone,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
     #{telephone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{jobtitle,jdbcType=VARCHAR},
     #{workingyears,jdbcType=VARCHAR}, #{contact,jdbcType=VARCHAR}, #{ctelephone,jdbcType=VARCHAR},
     #{finalunit,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{estartTime,jdbcType=DATE},
     #{efinalTime,jdbcType=DATE}, #{sname,jdbcType=VARCHAR}, #{college,jdbcType=VARCHAR},
     #{major,jdbcType=VARCHAR}, #{overseas,jdbcType=VARCHAR}, #{wstartTime,jdbcType=DATE},
     #{wfinalTime,jdbcType=DATE}, #{uname,jdbcType=VARCHAR}, #{post,jdbcType=VARCHAR},
     #{uaddress,jdbcType=VARCHAR}, #{credential,jdbcType=VARCHAR}, #{rank,jdbcType=VARCHAR},
     #{gettime,jdbcType=VARCHAR}, #{appellation,jdbcType=VARCHAR}, #{rname,jdbcType=VARCHAR},
     #{runit,jdbcType=VARCHAR}, #{raddress,jdbcType=VARCHAR})
 </insert>
 <insert id="insertSelective" parameterType="com.ims.info.entity.Person" >
   insert into person
   <trim prefix="(" suffix=")" suffixOverrides="," >
     <if test="sn != null" >
       sn,
     </if>
     <if test="name != null" >
       name,
     </if>
     <if test="sex != null" >
       sex,
     </if>
     <if test="nation != null" >
       nation,
     </if>
     <if test="birthdate != null" >
       birthdate,
     </if>
     <if test="idcard != null" >
       IDcard,
     </if>
     <if test="martial != null" >
       martial,
     </if>
     <if test="political != null" >
       political,
     </if>
     <if test="education != null" >
       education,
     </if>
     <if test="household != null" >
       household,
     </if>
     <if test="domicile != null" >
       domicile,
     </if>
     <if test="htelephone != null" >
       htelephone,
     </if>
     <if test="address != null" >
       address,
     </if>
     <if test="telephone != null" >
       telephone,
     </if>
     <if test="email != null" >
       email,
     </if>
     <if test="jobtitle != null" >
       jobtitle,
     </if>
     <if test="workingyears != null" >
       workingyears,
     </if>
     <if test="contact != null" >
       contact,
     </if>
     <if test="ctelephone != null" >
       ctelephone,
     </if>
     <if test="finalunit != null" >
       finalunit,
     </if>
     <if test="remark != null" >
       remark,
     </if>
     <if test="estartTime != null" >
       estart_time,
     </if>
     <if test="efinalTime != null" >
       efinal_time,
     </if>
     <if test="sname != null" >
       sname,
     </if>
     <if test="college != null" >
       college,
     </if>
     <if test="major != null" >
       major,
     </if>
     <if test="overseas != null" >
       overseas,
     </if>
     <if test="wstartTime != null" >
       wstart_time,
     </if>
     <if test="wfinalTime != null" >
       wfinal_time,
     </if>
     <if test="uname != null" >
       uname,
     </if>
     <if test="post != null" >
       post,
     </if>
     <if test="uaddress != null" >
       uaddress,
     </if>
     <if test="credential != null" >
       credential,
     </if>
     <if test="rank != null" >
       rank,
     </if>
     <if test="gettime != null" >
       gettime,
     </if>
     <if test="appellation != null" >
       appellation,
     </if>
     <if test="rname != null" >
       rname,
     </if>
     <if test="runit != null" >
       runit,
     </if>
     <if test="raddress != null" >
       raddress,
     </if>
   </trim>
   <trim prefix="values (" suffix=")" suffixOverrides="," >
     <if test="sn != null" >
       #{sn,jdbcType=CHAR},
     </if>
     <if test="name != null" >
       #{name,jdbcType=VARCHAR},
     </if>
     <if test="sex != null" >
       #{sex,jdbcType=VARCHAR},
     </if>
     <if test="nation != null" >
       #{nation,jdbcType=VARCHAR},
     </if>
     <if test="birthdate != null" >
       #{birthdate,jdbcType=DATE},
     </if>
     <if test="idcard != null" >
       #{idcard,jdbcType=VARCHAR},
     </if>
     <if test="martial != null" >
       #{martial,jdbcType=VARCHAR},
     </if>
     <if test="political != null" >
       #{political,jdbcType=VARCHAR},
     </if>
     <if test="education != null" >
       #{education,jdbcType=VARCHAR},
     </if>
     <if test="household != null" >
       #{household,jdbcType=VARCHAR},
     </if>
     <if test="domicile != null" >
       #{domicile,jdbcType=VARCHAR},
     </if>
     <if test="htelephone != null" >
       #{htelephone,jdbcType=VARCHAR},
     </if>
     <if test="address != null" >
       #{address,jdbcType=VARCHAR},
     </if>
     <if test="telephone != null" >
       #{telephone,jdbcType=VARCHAR},
     </if>
     <if test="email != null" >
       #{email,jdbcType=VARCHAR},
     </if>
     <if test="jobtitle != null" >
       #{jobtitle,jdbcType=VARCHAR},
     </if>
     <if test="workingyears != null" >
       #{workingyears,jdbcType=VARCHAR},
     </if>
     <if test="contact != null" >
       #{contact,jdbcType=VARCHAR},
     </if>
     <if test="ctelephone != null" >
       #{ctelephone,jdbcType=VARCHAR},
     </if>
     <if test="finalunit != null" >
       #{finalunit,jdbcType=VARCHAR},
     </if>
     <if test="remark != null" >
       #{remark,jdbcType=VARCHAR},
     </if>
     <if test="estartTime != null" >
       #{estartTime,jdbcType=DATE},
     </if>
     <if test="efinalTime != null" >
       #{efinalTime,jdbcType=DATE},
     </if>
     <if test="sname != null" >
       #{sname,jdbcType=VARCHAR},
     </if>
     <if test="college != null" >
       #{college,jdbcType=VARCHAR},
     </if>
     <if test="major != null" >
       #{major,jdbcType=VARCHAR},
     </if>
     <if test="overseas != null" >
       #{overseas,jdbcType=VARCHAR},
     </if>
     <if test="wstartTime != null" >
       #{wstartTime,jdbcType=DATE},
     </if>
     <if test="wfinalTime != null" >
       #{wfinalTime,jdbcType=DATE},
     </if>
     <if test="uname != null" >
       #{uname,jdbcType=VARCHAR},
     </if>
     <if test="post != null" >
       #{post,jdbcType=VARCHAR},
     </if>
     <if test="uaddress != null" >
       #{uaddress,jdbcType=VARCHAR},
     </if>
     <if test="credential != null" >
       #{credential,jdbcType=VARCHAR},
     </if>
     <if test="rank != null" >
       #{rank,jdbcType=VARCHAR},
     </if>
     <if test="gettime != null" >
       #{gettime,jdbcType=VARCHAR},
     </if>
     <if test="appellation != null" >
       #{appellation,jdbcType=VARCHAR},
     </if>
     <if test="rname != null" >
       #{rname,jdbcType=VARCHAR},
     </if>
     <if test="runit != null" >
       #{runit,jdbcType=VARCHAR},
     </if>
     <if test="raddress != null" >
       #{raddress,jdbcType=VARCHAR},
     </if>
   </trim>
 </insert>
 <update id="updateByPrimaryKeySelective" parameterType="com.ims.info.entity.Person" >
   update person
   <set >
     <if test="name != null" >
       name = #{name,jdbcType=VARCHAR},
     </if>
     <if test="sex != null" >
       sex = #{sex,jdbcType=VARCHAR},
     </if>
     <if test="nation != null" >
       nation = #{nation,jdbcType=VARCHAR},
     </if>
     <if test="birthdate != null" >
       birthdate = #{birthdate,jdbcType=DATE},
     </if>
     <if test="idcard != null" >
       IDcard = #{idcard,jdbcType=VARCHAR},
     </if>
     <if test="martial != null" >
       martial = #{martial,jdbcType=VARCHAR},
     </if>
     <if test="political != null" >
       political = #{political,jdbcType=VARCHAR},
     </if>
     <if test="education != null" >
       education = #{education,jdbcType=VARCHAR},
     </if>
     <if test="household != null" >
       household = #{household,jdbcType=VARCHAR},
     </if>
     <if test="domicile != null" >
       domicile = #{domicile,jdbcType=VARCHAR},
     </if>
     <if test="htelephone != null" >
       htelephone = #{htelephone,jdbcType=VARCHAR},
     </if>
     <if test="address != null" >
       address = #{address,jdbcType=VARCHAR},
     </if>
     <if test="telephone != null" >
       telephone = #{telephone,jdbcType=VARCHAR},
     </if>
     <if test="email != null" >
       email = #{email,jdbcType=VARCHAR},
     </if>
     <if test="jobtitle != null" >
       jobtitle = #{jobtitle,jdbcType=VARCHAR},
     </if>
     <if test="workingyears != null" >
       workingyears = #{workingyears,jdbcType=VARCHAR},
     </if>
     <if test="contact != null" >
       contact = #{contact,jdbcType=VARCHAR},
     </if>
     <if test="ctelephone != null" >
       ctelephone = #{ctelephone,jdbcType=VARCHAR},
     </if>
     <if test="finalunit != null" >
       finalunit = #{finalunit,jdbcType=VARCHAR},
     </if>
     <if test="remark != null" >
       remark = #{remark,jdbcType=VARCHAR},
     </if>
     <if test="estartTime != null" >
       estart_time = #{estartTime,jdbcType=DATE},
     </if>
     <if test="efinalTime != null" >
       efinal_time = #{efinalTime,jdbcType=DATE},
     </if>
     <if test="sname != null" >
       sname = #{sname,jdbcType=VARCHAR},
     </if>
     <if test="college != null" >
       college = #{college,jdbcType=VARCHAR},
     </if>
     <if test="major != null" >
       major = #{major,jdbcType=VARCHAR},
     </if>
     <if test="overseas != null" >
       overseas = #{overseas,jdbcType=VARCHAR},
     </if>
     <if test="wstartTime != null" >
       wstart_time = #{wstartTime,jdbcType=DATE},
     </if>
     <if test="wfinalTime != null" >
       wfinal_time = #{wfinalTime,jdbcType=DATE},
     </if>
     <if test="uname != null" >
       uname = #{uname,jdbcType=VARCHAR},
     </if>
     <if test="post != null" >
       post = #{post,jdbcType=VARCHAR},
     </if>
     <if test="uaddress != null" >
       uaddress = #{uaddress,jdbcType=VARCHAR},
     </if>
     <if test="credential != null" >
       credential = #{credential,jdbcType=VARCHAR},
     </if>
     <if test="rank != null" >
       rank = #{rank,jdbcType=VARCHAR},
     </if>
     <if test="gettime != null" >
       gettime = #{gettime,jdbcType=VARCHAR},
     </if>
     <if test="appellation != null" >
       appellation = #{appellation,jdbcType=VARCHAR},
     </if>
     <if test="rname != null" >
       rname = #{rname,jdbcType=VARCHAR},
     </if>
     <if test="runit != null" >
       runit = #{runit,jdbcType=VARCHAR},
     </if>
     <if test="raddress != null" >
       raddress = #{raddress,jdbcType=VARCHAR},
     </if>
   </set>
   where sn = #{sn,jdbcType=CHAR}
 </update>
 <update id="updateByPrimaryKey" parameterType="com.ims.info.entity.Person" >
   update person
   set name = #{name,jdbcType=VARCHAR},
     sex = #{sex,jdbcType=VARCHAR},
     nation = #{nation,jdbcType=VARCHAR},
     birthdate = #{birthdate,jdbcType=DATE},
     IDcard = #{idcard,jdbcType=VARCHAR},
     martial = #{martial,jdbcType=VARCHAR},
     political = #{political,jdbcType=VARCHAR},
     education = #{education,jdbcType=VARCHAR},
     household = #{household,jdbcType=VARCHAR},
     domicile = #{domicile,jdbcType=VARCHAR},
     htelephone = #{htelephone,jdbcType=VARCHAR},
     address = #{address,jdbcType=VARCHAR},
     telephone = #{telephone,jdbcType=VARCHAR},
     email = #{email,jdbcType=VARCHAR},
     jobtitle = #{jobtitle,jdbcType=VARCHAR},
     workingyears = #{workingyears,jdbcType=VARCHAR},
     contact = #{contact,jdbcType=VARCHAR},
     ctelephone = #{ctelephone,jdbcType=VARCHAR},
     finalunit = #{finalunit,jdbcType=VARCHAR},
     remark = #{remark,jdbcType=VARCHAR},
     estart_time = #{estartTime,jdbcType=DATE},
     efinal_time = #{efinalTime,jdbcType=DATE},
     sname = #{sname,jdbcType=VARCHAR},
     college = #{college,jdbcType=VARCHAR},
     major = #{major,jdbcType=VARCHAR},
     overseas = #{overseas,jdbcType=VARCHAR},
     wstart_time = #{wstartTime,jdbcType=DATE},
     wfinal_time = #{wfinalTime,jdbcType=DATE},
     uname = #{uname,jdbcType=VARCHAR},
     post = #{post,jdbcType=VARCHAR},
     uaddress = #{uaddress,jdbcType=VARCHAR},
     credential = #{credential,jdbcType=VARCHAR},
     rank = #{rank,jdbcType=VARCHAR},
     gettime = #{gettime,jdbcType=VARCHAR},
     appellation = #{appellation,jdbcType=VARCHAR},
     rname = #{rname,jdbcType=VARCHAR},
     runit = #{runit,jdbcType=VARCHAR},
     raddress = #{raddress,jdbcType=VARCHAR}
   where sn = #{sn,jdbcType=CHAR}
 </update>

 <select id="selectAll" resultMap="BaseResultMap">
   select * from person
 </select>

</mapper>

Biz接口类如下

package com.ims.info.biz;

import com.ims.info.entity.Person;

import java.util.List;

public interface PersonBiz {
   void add(Person person);
   void edit(Person person);
   void remove(String sn);
   Person get(String sn);
   List<Person>getAll();
}

Biz接口实现类如下

package com.ims.info.biz.impl;

import com.ims.info.biz.PersonBiz;
import com.ims.info.dao.PersonMapper;
import com.ims.info.entity.Person;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service("personBiz")
public class PersonBizImpl implements PersonBiz {
   @Resource
   private PersonMapper personMapper;
   public void add(Person person) {
       personMapper.insert ( person );
   }

   public void edit(Person person) {
       personMapper.updateByPrimaryKey ( person );
   }

   public void remove(String sn) {
       personMapper.deleteByPrimaryKey ( sn );
   }

   public Person get(String sn) {

       return personMapper.selectByPrimaryKey ( sn );
   }

   public List<Person> getAll() {
       return personMapper.selectAll ();
   }
}

控制类源码如下

package com.ims.info.controller;

import com.ims.info.biz.PersonBiz;
import com.ims.info.entity.Person;
import com.ims.info.global.Contant;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.Map;

@Controller("personController")
@RequestMapping("person")
public class PersonController {
   @Resource
   private PersonBiz personBiz;

   @RequestMapping("/list")
   public String list(Map<String,Object> map){
       map.put ( "list",personBiz.getAll () );
       return "person_list";
   }

   @RequestMapping("/to_add")
   public String toAdd(Map<String,Object> map){
       map.put ( "person",new Person () );
       map.put ( "slist", Contant.getSexs ( ) );
       map.put ( "mlist", Contant.getMartials ( ) );
       map.put ( "plist", Contant.getPoliticals ());
       map.put ( "elist", Contant.getEducations ());
       map.put ( "hlist", Contant.getHouseholds () );
       map.put ( "olist", Contant.getOverSeas ());
       map.put ( "alist", Contant.getAppellations ());
       return "person_add";
   }
   @RequestMapping("/add")
   public String add(Person person){
       personBiz.add ( person );
       return "redirect:list";
   }

   @RequestMapping(value = "/to_update",params = "sn")
   public String toUpdate(String sn,Map<String,Object> map){
       map.put ( "person",personBiz.get(sn) );
       map.put ( "slist", Contant.getSexs ( ) );
       map.put ( "mlist", Contant.getMartials ( ) );
       map.put ( "plist", Contant.getPoliticals ());
       map.put ( "elist", Contant.getEducations ());
       map.put ( "hlist", Contant.getHouseholds () );
       map.put ( "olist", Contant.getOverSeas ());
       map.put ( "alist", Contant.getAppellations ());
       return "person_update";
   }
   @RequestMapping("/update")
   public String update(Person person){
       personBiz.edit ( person );
       return "redirect:list";
   }
   @RequestMapping(value = "/remove",params = "sn")
   public String remove(String sn){
       personBiz.remove ( sn );
       return "redirect:list";
   }
}

Contant添加数据列表如下:

package com.ims.info.global;
//创建数据字典,java常量类
import java.util.ArrayList;
import java.util.List;

public class Contant {
   //职务
   public static final String POST_STAFF="员工";
   public static final String POST_FM="部门经理";
   public static final String POST_GM="总经理";
   public static final String POST_CASHIER="财务";
   public static List<String> getPosts(){
       List<String> list = new ArrayList<String>();
       list.add(POST_STAFF);
       list.add(POST_FM);
       list.add(POST_GM);
       list.add(POST_CASHIER);
       return list;
   }

   //费用类别
   public static List<String> getItems(){
       List<String> list = new ArrayList<String>();
       list.add("交通");
       list.add("餐饮");
       list.add("住宿");
       list.add("办公");
       return list;
   }

   //报销单状态
   public static final String CLAIMVOUCHER_CREATED="新创建";
   public static final String CLAIMVOUCHER_SUBMIT="已提交";
   public static final String CLAIMVOUCHER_APPROVED="已审核";
   public static final String CLAIMVOUCHER_BACK="已打回";
   public static final String CLAIMVOUCHER_TERMINATED="已终止";
   public static final String CLAIMVOUCHER_RECHECK="待复审";
   public static final String CLAIMVOUCHER_PAID="已打款";
   //审核额度
   public static final double LIMIT_CHECK=5000.00;

   //处理方式
   public static final String DEAL_CREATE="创建";
   public static final String DEAL_SUBMIT="提交";
   public static final String DEAL_UPDATE="修改";
   public static final String DEAL_BACK="打回";
   public static final String DEAL_REJECT="拒绝";
   public static final String DEAL_PASS="通过";
   public static final String DEAL_PAID="打款";

   //性别
   public static List<String> getSexs(){
       List<String>list = new ArrayList<String> (  );
       list.add("男");
       list.add("女");
       return list;
   }

   //婚姻状况
   public static List<String> getMartials(){
       List<String>list = new ArrayList<String> (  );
       list.add("未婚");
       list.add("已婚");
       list.add("离异");
       return list;
   }

   //政治面貌
   public static List<String> getPoliticals(){
       List<String>list = new ArrayList<String> (  );
       list.add("群众");
       list.add("团员");
       list.add("党员");
       list.add("预备党员");
       list.add("民主党派");
       return list;
   }

   //学历
   public static List<String> getEducations(){
       List<String>list = new ArrayList<String> (  );
       list.add("专科");
       list.add("本科");
       list.add("硕士研究生");
       list.add("博士研究生");
       return list;
   }

   //户口性质
   public static List<String> getHouseholds(){
       List<String>list = new ArrayList<String> (  );
       list.add("本市城镇");
       list.add("本市农村");
       list.add("本省城镇");
       list.add("本省农村");
       list.add("外省城镇");
       list.add("外省农村");
       return list;
   }

   //是否具有海外经历
   public static List<String> getOverSeas(){
       List<String>list = new ArrayList<String> (  );
       list.add("是");
       list.add("否");
       return list;
   }

   //直系亲属称谓
   public static List<String> getAppellations(){
       List<String>list = new ArrayList<String> (  );
       list.add("父亲");
       list.add("母亲");
       list.add("姐妹");
       list.add("兄弟");
       return list;
   }

}

依据items.js文件改写person.js文件如下:

$(document).ready(function(){
  builderIndex();
   setRemove();
  $("#addEducationButton").click(
     function(){
        $("#education").children("div").last().after($("#education").children("div").first().clone());
           setRemove();
        $("#education").find("button").attr("disabled",false);
        builderIndex();
     }
  );
});

function builderIndex(){
  $.each($("#education").children(),function(i,val){
     $("#education").children("div").eq(i).children().eq(0).find("input").attr("name","education["+i+"].estartTime");
     $("#education").children("div").eq(i).children().eq(1).find("input").attr("name","education["+i+"].efinalTime");
       $("#education").children("div").eq(i).children().eq(2).find("input").attr("name","education["+i+"].sname");
       $("#education").children("div").eq(i).children().eq(3).find("input").attr("name","education["+i+"].college");
       $("#education").children("div").eq(i).children().eq(4).find("input").attr("name","education["+i+"].major");
       $("#education").children("div").eq(i).children().eq(5).find("select").attr("name","education["+i+"].overseas");
  });    
}


function setRemove(){
   $("#education").children("div").find("button").click(
       function(){
           $(this).parent().parent().remove();
           if($("#education").children("div").size()==1){
               $("#education").find("button").attr("disabled",true);
           }
           builderIndex();
       }
   );
}

页面实现person_list.jsp文件源码如下:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="top.jsp"/>

<section id="content" class="table-layout animated fadeIn">
   <div class="tray tray-center">
       <div class="content-header">
           <h2> 人员列表 </h2>
           <p class="lead"></p>
       </div>
       <div class="admin-form theme-primary mw1000 center-block" style="">
           <div class="panel  heading-border">
               <div class="panel-menu">
                   <div class="row">
                       <div class="hidden-xs hidden-sm col-md-3">
                           <div class="btn-group">
                               <button type="button" class="btn btn-default light">
                                   <i class="fa fa-refresh"></i>
                               </button>
                               <button type="button" class="btn btn-default light">
                                   <i class="fa fa-trash"></i>
                               </button>
                               <button type="button" class="btn btn-default light">
                                   <i class="fa fa-plus" onclick="javascript:window.location.href='/person/to_add';"></i>
                               </button>
                           </div>
                       </div>
                       <div class="col-xs-12 col-md-9 text-right">
                           <div class="btn-group">
                               <button type="button" class="btn btn-default light">
                                   <i class="fa fa-chevron-left"></i>
                               </button>
                               <button type="button" class="btn btn-default light">
                                   <i class="fa fa-chevron-right"></i>
                               </button>
                           </div>
                       </div>
                   </div>
               </div>
               <div class="panel-body pn">
                   <table id="message-table" class="table admin-form theme-warning tc-checkbox-1">
                       <thead>
                       <tr class="">
                           <th class="text-center hidden-xs">Select</th>
                           <th class="hidden-xs">人员编号</th>
                           <th class="hidden-xs">姓名</th>
                           <th class="hidden-xs">性别</th>
                           <th class="hidden-xs">出生日期</th>
                           <th class="hidden-xs">邮箱</th>
                           <th class="hidden-xs">联系电话</th>
                           <th>操作</th>
                       </tr>
                       </thead>
                       <tbody>
                       <c:forEach items="${list}" var="per">
                       <tr class="message-unread">
                           <td class="hidden-xs">
                               <label class="option block mn">
                                   <input type="checkbox" name="mobileos" value="FR">
                                   <span class="checkbox mn"></span>
                               </label>
                           </td>
                           <td>${per.sn}</td>
                           <td>${per.name}</td>
                           <td>${per.sex}</td>
                           <td>${per.birthdate}</td>
                           <td>${per.email}</td>
                           <td>${per.telephone}</td>
                           <td>
                               <a href="/person/to_update?sn=${per.sn}">编辑</a>
                               <a href="/person/remove?sn=${per.sn}">删除</a>
                           </td>
                       </tr>
                           <tr >

                           </tr>
                       </c:forEach>
                       </tbody>
                   </table>
               </div>
           </div>
       </div>
   </div>
</section>

<jsp:include page="bottom.jsp"/>

person_add.jsp文件源码如下:

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="top.jsp"/>

<style type="text/css">
   th{
       text-align:center;/** 设置水平方向居中 */
       vertical-align:middle/** 设置垂直方向居中 */
   }
   td{
       text-align:center;/** 设置水平方向居中 */
       vertical-align:middle/** 设置垂直方向居中 */
   }

</style>
<section id="content" class="table-layout animated fadeIn">
   <div class="tray tray-center">
       <div class="content-header">
           <h2> 添加人员 </h2>
           <p class="lead"></p>
       </div>
       <div class="admin-form theme-primary mw1200 center-block" style="padding-bottom: 175px;">
           <div class="panel heading-border">
               <form:form action="/person/add" modelAttribute="person" id="admin-form" name="addForm"  >
                   <div class="panel-body bg-light">
                       <div class="section-divider mt20 mb40">
                           <span> 基本信息 </span>
                       </div>

                       <div class="panel-body pn">
                           <table id="message-table" class="table admin-form theme-warning tc-checkbox-1">
                                   <tr>
                                       <td><label for="sn">人员编号</label></td>
                                       <td><form:input  path="sn"  value="" class="text ui-widget-content ui-corner-all"/></td>

                                       <td><label for="name">姓名</label></td>
                                       <td><form:input path="name"  value="" class="text ui-widget-content ui-corner-all"/></td>

                                       <td><label for="sex">性别</label></td>
                                       <td>
                                           <form:select path="sex" items="${slist}" style="width: 150px;"/>
                                       </td>

                                       <td><label for="nation">民族</label></td>
                                       <td><form:input path="nation" value="" class="text ui-widget-content ui-corner-all"/></td>
                                   </tr>
                                   <tr>
                                       <td><label for="birthdate">出生日期</label></td>
                                       <td><form:input  type="date" path="birthdate" value="" class="text ui-widget-content ui-corner-all"/></td>
                                       <td><label for="idcard">身份证号</label></td>
                                       <td><form:input  path="idcard" value="" class="text ui-widget-content ui-corner-all"/></td>

                                       <td><label for="martial">婚姻状况</label></td>
                                       <td>
                                           <form:select path="martial" items="${mlist}" style="width: 150px;"/>
                                       </td>

                                       <td><label for="political">政治面貌</label></td>
                                       <td>
                                           <form:select path="political" items="${plist}" style="width: 150px;"/>
                                       </td>
                                   </tr>
                                   <tr>
                                       <td><label for="education">学历</label></td>
                                       <td>
                                           <form:select path="education" items="${elist}"  style="width: 150px;"/>
                                       </td>
                                       <td><label for="household">户口性质</label></td>
                                       <td>
                                           <form:select path="household" items="${hlist}"  style="width: 150px;"/>
                                       </td>
                                       <td><label for="domicile">现户口所在地</label></td>
                                       <td><form:input  path="domicile" value="" class="text ui-widget-content ui-corner-all"/></td>
                                       <td><label for="htelephone">家庭电话</label></td>
                                       <td><form:input  path="htelephone" value="" class="text ui-widget-content ui-corner-all"/></td>
                                   </tr>
                                   <tr>
                                       <td><label for="address">现住址</label></td>
                                       <td><form:input  path="address" value="" class="text ui-widget-content ui-corner-all"/></td>
                                       <td><label for="telephone">联系电话</label></td>
                                       <td><form:input  path="telephone" value="" class="text ui-widget-content ui-corner-all"/></td>
                                       <td><label for="email">个人邮箱</label></td>
                                       <td><form:input  path="email" value="" class="text ui-widget-content ui-corner-all"/></td>
                                       <td><label for="jobtitle">职称</label></td>
                                       <td><form:input  path="jobtitle" value="" class="text ui-widget-content ui-corner-all"/></td>
                                   </tr>
                                   <tr>
                                       <td ><label for="workingyears">工作年限</label></td>
                                       <td><form:input  path="workingyears" value="" class="text ui-widget-content ui-corner-all"/></td>
                                       <td style="text-align:center;"><label for="contact">紧急联系人</label></td>
                                       <td><form:input  path="contact" value="" class="text ui-widget-content ui-corner-all"/></td>
                                       <td><label for="ctelephone">联系人电话</label></td>
                                       <td><form:input  path="ctelephone" value="" class="text ui-widget-content ui-corner-all"/></td>
                                       <td><label for="finalunit">最后任职单位</label></td>
                                       <td><form:input path="finalunit" value="" class="text ui-widget-content ui-corner-all"/></td>
                                   </tr>
                               </table>
                       </div>

                       <div class="section-divider mt20 mb40">
                           <span> 教育经历 </span>
                       </div>

                       <div>
                           <table  class="table table-striped table-bordered table-hover dataTable no-footer" role="grid">
                                   <th tabindex="0" aria-controls="dynamic-table" rowspan="1"class="col-md-1" >
                                       起始时间
                                   </th>
                                   <th tabindex="0" aria-controls="dynamic-table" rowspan="1"class="col-md-1" >
                                       终止时间
                                   </th>
                                   <th tabindex="0" aria-controls="dynamic-table" rowspan="1"class="col-md-2" >
                                       学校名称
                                   </th>
                                   <th tabindex="0" aria-controls="dynamic-table" rowspan="1" class="col-md-2">
                                       学院名称
                                   </th>
                                   <th tabindex="0" aria-controls="dynamic-table" rowspan="1" class="col-md-2">
                                       专业名称
                                   </th>
                                   <th tabindex="0" aria-controls="dynamic-table" rowspan="1" class="col-md-1">
                                       海外经历
                                   </th>
                           </table>
                       </div>

                     <div class="section row" id="education">
                         <div>
                               <div class="col-md-1">
                                   <form:input type="date"  path="education[0].estartTime" class="text ui-widget-content ui-corner-all"/>
                               </div>
                               <div class="col-md-1">
                                   <form:input type="date" path="education[0].efinalTime" class="text ui-widget-content ui-corner-all"/>
                               </div>
                               <div class="col-md-1">
                                   <form:input  path="education[0].sname" class="text ui-widget-content ui-corner-all"/>
                               </div>

                               <div class="col-md-1">
                                   <form:input path="education[0].college" class="text ui-widget-content ui-corner-all"/>
                               </div>

                               <div class="col-md-1">
                                   <form:input  path="education[0].major" class="text ui-widget-content ui-corner-all"/>
                               </div>
                               <div class="col-md-1">
                                   <form:input  type="text"  path="education[0].overseas" class="text ui-widget-content ui-corner-all"/>
                               </div>
                           </div>
                       </div>
                       <div class="section row">
                           <div class="section" style="text-align:right;">
                               <div class="col-md-12">
                                   <button type="button" class="button" id="addEducationButton"> + </button>
                               </div>
                           </div>
                       </div>
                       <div class="panel-footer text-right">
                           <button type="submit" class="button"> 保存 </button>
                           <button type="button" class="button" onclick="javascript:window.history.go(-1);"> 返回 </button>
                       </div>
                   </div>
               </form:form>
           </div>
       </div>
   </div>
</section>
<jsp:include page="bottom.jsp"/>


点击保存按钮会出现如下报错

http://img1.sycdn.imooc.com//climg/5b29b3080001898c13020223.jpg

http://img1.sycdn.imooc.com//climg/5b29b3060001671413410610.jpg

如严格按照employee_add.jsp格式编写人员表单则可直接关联到person_list.jsp页面,不会报错,调试后发下是<div>标签中添加了<table>标签就会报这个错误,如果都用<div>标签就不会出错。请问是什么原因?

另外person_add.jsp文件源码中以下部分一直标红,已按items.js文件编写person.js文件,错误原因是什么呢http://img1.sycdn.imooc.com//climg/5b29b4920001fca909600420.jpg


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
一叶知秋519 2018-06-20 11:21:06

1、建议同学贴代码时对代码进行代码语言的格式化,同时说明每个文件的文件名,方便我们运行你的代码找到每个文件之间的关系;

2、标红的地方会影响代码的运行吗?

  • 提问者 慕村8269932 #1
    标红处影响运行的,运行结果不显示标红处所在<div>的内容
    2018-06-21 08:44:00
  • 提问者 慕村8269932 #2
    更改以下: 代码运行后不能刷新出整个页面
    2018-06-21 08:54:32
  • 一叶知秋519 回复 提问者 慕村8269932 #3
    已在这个问答中回复,https://class.imooc.com/course/qadetail/56622 建议同学将代码贴全,可以集中到一个问答下去回复。祝学习愉快!
    2018-06-21 11:58:04
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
SSM主流框架入门与综合项目实战2018版
  • 参与学习           人
  • 提交作业       205    份
  • 解答问题       4317    个

Java中非常实用的SSM整合开发内容,从Spring开始,到MyBaits的进阶内容,再到SpringMVC的应用,最后是SSM整合开发案例,逐步深入,助你成长为一名Java工程师!

了解课程
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师