正在回答 回答被采纳积分+1
3回答
芝芝兰兰
2019-07-04 18:58:03
同学你好。还可以看一下,DepartmentDao.xml中的parameterType是否写成“department”了?
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.4//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.imooc.sm.dao.DepartmentDao"> <resultMap id="resultMap" type="Department"> <id property="id" column="id" javaType="Integer"/> <result property="name" column="name" javaType="String"/> <result property="address" column="address" javaType="String"/> </resultMap> <insert id="insert" parameterType="Department" useGeneratedKeys="true"> insert into department(name,address) values(#{name},#{address}) </insert> <delete id="delete" parameterType="Integer"> delete from department where id=#{id} </delete> <update id="update" parameterType="Department"> update department set name=#{name},address=#{address} where id=#{id} </update> <select id="selectById" parameterType="Integer" resultMap="resultMap"> select * from department where id=#{id} </select> <select id="selectAll" resultMap="resultMap"> select * from department </select> </mapper>
如果解答了同学的疑问,望采纳~
祝学习愉快~
SSM主流框架入门与综合项目实战2018版
- 参与学习 人
- 提交作业 205 份
- 解答问题 4317 个
Java中非常实用的SSM整合开发内容,从Spring开始,到MyBaits的进阶内容,再到SpringMVC的应用,最后是SSM整合开发案例,逐步深入,助你成长为一名Java工程师!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星