2026-06-25 a26b31cc9f3ee9b21b1a754e80fa7359e8a7a8f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?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="cn.iocoder.yudao.module.erp.dal.mysql.statistics.ErpSaleStatisticsMapper">
 
    <select id="getSalePrice" resultType="java.math.BigDecimal">
        SELECT
            (SELECT IFNULL(SUM(total_price), 0)
             FROM erp_sale_out
             WHERE out_time >= #{beginTime}
               <if test="endTime != null">
                   AND out_time &lt; #{endTime}
               </if>
               <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null">
                   AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
               </if>
               AND deleted = 0) -
            (SELECT IFNULL(SUM(total_price), 0)
                FROM erp_sale_return
                WHERE return_time >= #{beginTime}
                <if test="endTime != null">
                    AND return_time &lt; #{endTime}
                </if>
                <if test="@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId() != null">
                    AND tenant_id = ${@cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder@getTenantId()}
                </if>
                AND deleted = 0)
    </select>
 
</mapper>