<?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="org.wfc.user.mapper.UBillMapper">

    <select id="getBillByUser" resultType="org.wfc.user.domain.vo.UBillUserVo">
        SELECT
            b.id,
            h.start_time,
            h.end_time,
            h.traffic_up + h.traffic_down traffic,
            b.amount,
            b.create_time,
            b.`status`
        FROM
            u_bill b
            LEFT JOIN u_cdr_history h ON h.id = b.cdr_history_id
            AND h.del_flag = 0
            AND b.user_id = #{userId}
        order by b.create_time desc
    </select>
</mapper>
