<?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.njcn.system.mapper.LargeScreenMapper">

    <select id="getUserScale" resultType="com.njcn.device.pq.pojo.vo.UserScaleVO">
        SELECT DATE_FORMAT(REGISTER_TIME, '%Y-%m') AS `timeId`, COUNT(*) AS `monthIncrementNum`
        FROM app_user
        <where>
        STATE = '1'
        <if test="searchBeginTime != null and searchBeginTime != ''">
            and date_format(REGISTER_TIME,'%y%m%d') &gt;= date_format(#{searchBeginTime},'%y%m%d')
        </if>
        <if test="searchEndTime != null and searchEndTime != ''">
            and date_format(REGISTER_TIME,'%y%m%d') &lt;= date_format(#{searchEndTime},'%y%m%d')
        </if>
        </where>
        GROUP BY `timeId`;
    </select>

    <select id="getDataScale" resultType="com.njcn.device.pq.pojo.vo.DataScaleVO">
        SELECT DATE(pd.TIMEID) as "timeId", round(sum(DATASTATIS),2) as "dataStatis"
        FROM pqs_datastatis pd
        <where>
        <if test="searchBeginTime != null and searchBeginTime != ''">
            and date_format(pd.TIMEID,'%y%m%d') &gt;= date_format(#{searchBeginTime},'%y%m%d')
        </if>
        <if test="searchEndTime != null and searchEndTime != ''">
            and date_format(pd.TIMEID,'%y%m%d') &lt;= date_format(#{searchEndTime},'%y%m%d')
        </if>
        </where>
        GROUP BY DATE(pd.TIMEID);
    </select>

</mapper>
