Helius
2020-12-30 9b55f87ffe20ff8069d8869ea0b43393af6303f0
zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
@@ -77,7 +77,7 @@
         where STATU in ('已付款', '欠款')
         and <![CDATA[order_time > #{item.beginTime}   and  order_time < #{item.endTime} ]]>
         <if test="companyId != null and companyId != 0">
            and company_id=17
            and company_id=#{companyId}
         </if>
         <if test="shopId !=null and shopId !=0 " >
            and SHOP_ID = #{shopId}
@@ -88,5 +88,104 @@
      from area where id=1
   </select>
   <select id="selectCashIncome" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select IFNULL(sum(cash_Pay), 0)
         from sys_order
         where STATU in ('已付款')
         and <![CDATA[order_time > #{item.beginTime}   and  order_time < #{item.endTime} ]]>
         <if test="companyId != null and companyId != 0">
            and company_id=#{companyId}
         </if>
         <if test="shopId !=null and shopId !=0 " >
            and SHOP_ID = #{shopId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectCardUse" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select IFNULL(sum(card_Pay), 0)
         from sys_order
         where STATU in ('已付款')
         and <![CDATA[order_time > #{item.beginTime}   and  order_time < #{item.endTime} ]]>
         <if test="companyId != null and companyId != 0">
            and company_id=#{companyId}
         </if>
         <if test="shopId !=null and shopId !=0 " >
            and SHOP_ID = #{shopId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectArrears" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select IFNULL(sum(card_Pay), 0)
         from sys_order
         where STATU in ('欠款')
         and <![CDATA[order_time > #{item.beginTime}   and  order_time < #{item.endTime} ]]>
         <if test="companyId != null and companyId != 0">
            and company_id=#{companyId}
         </if>
         <if test="shopId !=null and shopId !=0 " >
            and SHOP_ID = #{shopId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectHisConsume" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select IFNULL(sum(his_consume), 0)
         from achieve_new
         where order_type in ('服务单')
         and <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="companyId != null and companyId != 0">
            and company_id=#{companyId}
         </if>
         <if test="shopId !=null and shopId !=0 " >
            and SHOP_ID = #{shopId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectFreeConsume" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select IFNULL(sum(free_consume), 0)
         from achieve_new
         where order_type in ('服务单')
         and <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="companyId != null and companyId != 0">
            and company_id=#{companyId}
         </if>
         <if test="shopId !=null and shopId !=0 " >
            and SHOP_ID = #{shopId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
</mapper>