Blame view

urbanops-module-erp/src/main/resources/mapper/statistics/ErpSaleStatisticsMapper.xml 1.4 KB
2f252ffd   王彪总   feat(pay): 实现支付宝支...
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="com.zteits.urbanops.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="@com.zteits.urbanops.framework.tenant.core.context.TenantContextHolder@getTenantId() != null">
                     AND tenant_id = ${@com.zteits.urbanops.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="@com.zteits.urbanops.framework.tenant.core.context.TenantContextHolder@getTenantId() != null">
                      AND tenant_id = ${@com.zteits.urbanops.framework.tenant.core.context.TenantContextHolder@getTenantId()}
                  </if>
                  AND deleted = 0)
      </select>
  
  </mapper>