<?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.pz.system.mapper.StoreApplyMapper">
    <select id="selectDataView" resultType="com.pz.system.domain.vo.DataViewVo">
        SELECT count(id) as dataSum
        FROM store_apply
        WHERE `status` = 1
        <if test="dataViewBo.condition == 2">
            and create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) -- 近7天
        </if>
        <if test="dataViewBo.condition == 3">
            and create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) -- 近30天
        </if>
        <if test="dataViewBo.condition == 1">
            and create_time >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) -- 近1年
        </if>
    </select>
</mapper>