List<Category> queryCategoryByIds(List<Long> ids);
<!-- 通過Ids集合查詢 -->
<select id="queryCategoryByIds" resultMap="BaseResultMap" parameterType="java.util.List">
select * from tb_category d
where
d.id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</select>
int insertUserList(List<User> userList);
<insert id="insertUserList" parameterType="java.util.List">
insert into user(
username,
password,
phone,
email,
address
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{username,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR},
#{phone,jdbcType=BIGINT},
#{email,jdbcType=VARCHAR},
#{address,jdbcType=VARCHAR}
)
</foreach>
</insert>
int updateUserList(List<Integer> ids);
<update id="updateUserList" parameterType="java.util.List">
update user
<set>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=BIGINT},
</if>
<if test="name != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR}
</if>
</set>
where id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=",">
#{ids}
</foreach>
</update>