<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://www.72crm.com/mybatis-3.5.3-mapper.dtd">
<mapper namespace="com.kakarote.crm.mapper.CrmInvoiceMapper">
    <select id="queryById" resultType="com.kakarote.crm.entity.PO.CrmInvoice">
        select a.*,b.customer_name,c.num as contract_num,c.money as contract_money,d.realname as
        owner_user_name,e.realname as create_user_name
        from wk_crm_invoice as a
        left join wk_crm_customer as b on a.customer_id = b.customer_id
        left join wk_crm_contract as c on a.contract_id = c.contract_id
        left join wk_admin_user as d on a.owner_user_id = d.user_id
        left join wk_admin_user as e on a.create_user_id = e.user_id
        where invoice_id = #{id}
    </select>
    <select id="queryByIds" resultType="com.kakarote.crm.common.CrmModel">
        select a.*,b.customer_name,c.num as contract_num,c.money as contract_money,d.realname as
        owner_user_name,e.realname as create_user_name
        from wk_crm_invoice as a
        left join wk_crm_customer as b on a.customer_id = b.customer_id
        left join wk_crm_contract as c on a.contract_id = c.contract_id
        left join wk_admin_user as d on a.owner_user_id = d.user_id
        left join wk_admin_user as e on a.create_user_id = e.user_id
        where invoice_id = #{id}
    </select>
</mapper>
