无关风月
2024-09-04 78d7911139088c285abbddcb4746f3ea10a94f23
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderInvoiceMapper.xml
@@ -33,5 +33,115 @@
    <sql id="Base_Column_List">
        id, code, app_user_id, order_type, invoicing_company, invoice_type_id, invoice_type, invoice_material, invoicing_method, invoicing_object_type, name, tax_identification_number, company_address, company_phone, deposit_bank, bank_account, total_amount, invoice_url, mailbox, status, create_time, billing_time, billing_user_id
    </sql>
    <select id="pageList" resultType="com.ruoyi.order.api.vo.TOrderInvoiceVO">
        select toi.id, toi.code, toi.app_user_id, toi.order_type, toi.invoicing_company, toi.invoice_type_id, toi.invoice_type, toi.invoice_material,
               toi.invoicing_method, toi.invoicing_object_type, toi.name, toi.tax_identification_number, toi.company_address, toi.company_phone,
               toi.deposit_bank, toi.bank_account, toi.total_amount, toi.invoice_url, toi.mailbox, toi.status, toi.create_time, toi.billing_time,
               toi.billing_user_id
        from t_order_invoice toi
        <where>
            <if test="query.invoicingCompany != null and query.invoicingCompany != ''">
                AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%')
            </if>
            <if test="query.invoiceType != null and query.invoiceType != ''">
                AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%')
            </if>
            <if test="query.invoicingObjectType != null">
                AND toi.invoicing_object_type = #{query.invoicingObjectType}
            </if>
            <if test="query.invoiceMaterial != null">
                AND toi.invoice_material = #{query.invoiceMaterial}
            </if>
            <if test="query.invoicingMethod != null">
                AND toi.invoicing_method = #{query.invoicingMethod}
            </if>
            <if test="query.name != null and query.name != ''">
                AND toi.name LIKE concat('%',#{query.name},'%')
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.userIds != null and query.userIds.size()>0">
                AND toi.billing_user_id IN
                <foreach collection="query.userIds" close=")" open="(" item="userId" separator=",">
                    #{userId}
                </foreach>
            </if>
        </where>
        ORDER BY toi.billing_time DESC
    </select>
    <select id="statusCount" resultType="java.util.Map">
        select
            COUNT(CASE WHEN status = 1 THEN 1 END) AS `notAccepted`,
            COUNT(CASE WHEN status = 2 THEN 1 END) AS `processing`,
            COUNT(CASE WHEN status = 3 THEN 1 END) AS `finished`
        from t_order_invoice toi
        <where>
            <if test="query.invoicingCompany != null and query.invoicingCompany != ''">
                AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%')
            </if>
            <if test="query.invoiceType != null and query.invoiceType != ''">
                AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%')
            </if>
            <if test="query.invoicingObjectType != null">
                AND toi.invoicing_object_type = #{query.invoicingObjectType}
            </if>
            <if test="query.invoiceMaterial != null">
                AND toi.invoice_material = #{query.invoiceMaterial}
            </if>
            <if test="query.invoicingMethod != null">
                AND toi.invoicing_method = #{query.invoicingMethod}
            </if>
            <if test="query.name != null and query.name != ''">
                AND toi.name LIKE concat('%',#{query.name},'%')
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.userIds != null and query.userIds.size()>0">
                AND toi.billing_user_id IN
                <foreach collection="query.userIds" close=")" open="(" item="userId" separator=",">
                    #{userId}
                </foreach>
            </if>
        </where>
    </select>
    <select id="export" resultType="com.ruoyi.order.api.vo.TOrderInvoiceVO">
        select toi.id, toi.code, toi.app_user_id, toi.order_type, toi.invoicing_company, toi.invoice_type_id, toi.invoice_type, toi.invoice_material,
        toi.invoicing_method, toi.invoicing_object_type, toi.name, toi.tax_identification_number, toi.company_address, toi.company_phone,
        toi.deposit_bank, toi.bank_account, toi.total_amount, toi.invoice_url, toi.mailbox, toi.status, toi.create_time, toi.billing_time,
        toi.billing_user_id
        from t_order_invoice toi
        <where>
            <if test="query.invoicingCompany != null and query.invoicingCompany != ''">
                AND toi.invoicing_company LIKE concat('%',#{query.invoicingCompany},'%')
            </if>
            <if test="query.invoiceType != null and query.invoiceType != ''">
                AND toi.invoice_type LIKE concat('%',#{query.invoiceType},'%')
            </if>
            <if test="query.invoicingObjectType != null">
                AND toi.invoicing_object_type = #{query.invoicingObjectType}
            </if>
            <if test="query.invoiceMaterial != null">
                AND toi.invoice_material = #{query.invoiceMaterial}
            </if>
            <if test="query.invoicingMethod != null">
                AND toi.invoicing_method = #{query.invoicingMethod}
            </if>
            <if test="query.name != null and query.name != ''">
                AND toi.name LIKE concat('%',#{query.name},'%')
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND toi.billing_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.userIds != null and query.userIds.size()>0">
                AND toi.billing_user_id IN
                <foreach collection="query.userIds" close=")" open="(" item="userId" separator=",">
                    #{userId}
                </foreach>
            </if>
        </where>
        ORDER BY toi.billing_time DESC
    </select>
</mapper>