<?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="org.jeecg.modules.system.app.mapper.StatisticsInfoMapper">

    <select id="findByOrgCodeAndDay"
            resultType="org.jeecg.modules.system.app.vo.statistics.FindByStatisticsChartVO">
        <![CDATA[select * from nm_statistics_info  where org_code =#{orgCode} and date_daily >=#{firstDayInt} and date_daily <= #{dateAsInt}]]>
    </select>
    <select id="findByShopMoneyList"
            resultType="org.jeecg.modules.system.app.vo.statistics.FindByStatisticsChartVO">
         <![CDATA[
        select
                b.name as deptName,
                COALESCE(SUM(sale_money), 0) as saleMoney,
                b.id from  nm_site b
         left join  nm_statistics_info a on a.dept_id =b.tenant_id  and a.date_daily >=#{startTime} and a.date_daily <= #{endTime}
         where  b.org_code like CONCAT('',#{orgCode},'%')   and b.del_flag =0
        group by  b.id
        order by  saleMoney desc
         ]]>
    </select>
</mapper>