<?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.bonus.sgzb.app.mapper.AppMapper">


    <select id="getDayLeaseNum" resultType="java.lang.Integer">
        select COALESCE(SUM(pre_num), 0)
        from lease_apply_details
        WHERE create_time &gt;= #{startTime} AND create_time &lt;= #{endTime};
    </select>
    <select id="getDayBackNum" resultType="java.lang.Integer">
        select COALESCE(sum(pre_num), 0)
        from back_apply_details
        WHERE create_time &gt;= #{startTime} AND create_time &lt;= #{endTime};
    </select>
    <select id="getDayInputNum" resultType="java.lang.Integer">
        select COALESCE(sum(input_num), 0)
        from input_apply_details
        WHERE create_time &gt;= #{startTime} AND create_time &lt;= #{endTime};
    </select>
    <select id="getDayOutNum" resultType="java.lang.Integer">
        select COALESCE(sum(out_num), 0)
        from lease_out_details
        WHERE create_time &gt;= #{startTime} AND create_time &lt;= #{endTime};
    </select>
    <select id="getLeaseNum" resultType="java.lang.Integer">
        select count(1)
        from lease_apply_details
        where status = '0'
    </select>
    <select id="getBackNum" resultType="java.lang.Integer">
        select count(1)
        from back_apply_details
        where status = '0'
    </select>
    <select id="getScrapNum" resultType="java.lang.Integer">
        select count(1)
        from scrap_apply_details
        where status = '0'
    </select>
    <select id="getTrialNum" resultType="java.lang.Integer">
        select count(1)
        from scrap_apply_details
        where status = '0'
    </select>
</mapper>
