Helius
2020-12-31 5cd7e4d630e265faac43e7544880430dfce4a9ee
zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
@@ -283,5 +283,183 @@
      </if>
   </select>
   <select id="selectStaffOrderAchieve" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
            IFNULL(SUM((IFNULL(a.card_cash,0) +IFNULL(a.proj_cash,0) + IFNULL(a.goods_cash,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and sale_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffCashAchieve" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.proj_cash,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and sale_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffCardAchieve" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.card_cash,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and sale_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffGoodsAchieve" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.goods_cash,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and sale_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffCardUseAchieve" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.consume,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and sale_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffHisConsumeAchieve" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.his_consume,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and beault_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffFreeConsumeAchieve" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.free_consume,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and beault_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffCommissionAchieve" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.proj_percentage,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and beault_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffPeopleNum" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.number_of_people,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and beault_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffProjNum" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.proj_num,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and beault_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
   <select id="selectStaffProjTime" resultType="java.util.TreeMap">
      select
      <foreach collection="list" index="index" item="item"   separator=","  >
         (
         select
         IFNULL(SUM((IFNULL(a.proj_time,0))),0)
         from  achieve_new a
         where   <![CDATA[datatime > #{item.beginTime}   and  datatime < #{item.endTime} ]]>
         <if test="staffId != null and staffId != 0">
            and beault_id=#{staffId}
         </if>
         ) as t${index}
      </foreach>
      from area where id=1
   </select>
</mapper>