<?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.kxs.product.biz.mapper.KxsTicketMapper">

    <resultMap type="com.kxs.product.api.model.KxsTicket" id="KxsTicketMap">
        <result column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="del_flag" property="delFlag" />
        <result column="version" property="version" />
        <result column="user_id" property="userId" />
        <result column="ticket_code" property="ticketCode" />
        <result column="ticket_type" property="ticketType" />
        <result column="ticket_allot_path" property="ticketAllotPath" />
        <result column="order_id" property="orderId" />
        <result column="is_leader" property="isLeader" />
        <result column="status" property="status" />

    </resultMap>
    <update id="updateBatchTransfer">
        update kxs_ticket
        <set>
            <if test="userId != null">
                user_id = #{userId},
            </if>
        </set>
        where ticket_code in
        <foreach collection="ticketCodes" item="code" open="(" close=")" separator=",">
            #{code}
        </foreach>
    </update>

    <select id="getByPage" resultType="com.kxs.product.api.vo.kxsapp.ticket.TicketListVO">
        select id, ticket_code, ticket_type from kxs_ticket
        where user_id = #{userId} and status = 0 and ticket_type = #{ticketType}
    </select>

</mapper>
