因为需要修改的字段有多个,传递类型就不能使用 parameterType="" 了,可以是用这种方式进行简单的更改操作 。
#{index} 按照传递参数的顺序,把相应位置上的索引写在花括号里面
<!-- 修改数据 -->
<update id="alter">
update TimingTask set startTime=#{0},cycle=#{1},flag=#{2}
where taskName=#{3}
</update>
<mapper namespace="com.itcast.dao.VipMapper">
type里面是在SqlMapperConfig.xml 里面配置的 别名 id 是<select>标签需要的Map映射 column 是主键,其他的对应字段名称即可
<resultMap type="Vip" id="getList">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="age" property="age"/>
<result column="borthday" property="borthday"/>
<result column="email" property="email"/>
</resultMap>
<select id="list" resultMap="getList">
select * from vip;
</select>
</mapper>
type里面是在SqlMapperConfig.xml 里面配置的 别名 id 是<select>标签需要的Map映射 column 是主键,其他的对应字段名称即可
<resultMap type="Vip" id="getList">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="age" property="age"/>
<result column="borthday" property="borthday"/>
<result column="email" property="email"/>
</resultMap>
<select id="list" resultMap="getList">
select * from vip;
</select>
</mapper>