<?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.yxw.zuoye.dao.OrderMapper">

    <resultMap id="BaseResultMap" type="com.yxw.zuoye.entity.Order">
        <result column="orderId" jdbcType="VARCHAR" property="orderId" />
        <result column="userInfo" jdbcType="VARCHAR"  typeHandler="com.yxw.zuoye.typehandler.UserTypeHandler"/>
    </resultMap>

    <select id="getOrders" resultType="com.yxw.zuoye.entity.Order">
        select * from ordertable
    </select>

    <insert id="insertOrder" parameterType="com.yxw.zuoye.entity.Order">
        insert into ordertable(orderId,userInfo) values (#{orderId},#{userInfo})
    </insert>

    <insert id="insertOrderBatch">
        INSERT INTO ordertable
        (orderId, userInfo)
        VALUES
        <foreach collection ="list" item="order" separator =",">
            (#{order.orderId},#{order.userInfo})
        </foreach >
    </insert>
</mapper>