44323
2023-10-09 19251fb5596415bfa83c51b8ed130ecbb31644ce
cloud-server-account/src/main/resources/mapper/TAppUserMapper.xml
@@ -93,4 +93,184 @@
            </if>
        </where>
    </select>
    <select id="getYearUserCount" resultType="com.dsh.account.vo.entity.YearData">
        select IFNULL(count(*),0) AS yearCount,DATE_FORMAT(insertTime,'%Y') AS `year`  from t_app_user
        <where>
            <if test="dto.cityCode != null and dto.cityCode != ''">
                AND cityCode = #{dto.cityCode}
            </if>
            <if test="dto.isVip != null">
                AND isVip = #{dto.isVip}
            </if>
            <if test="dto.insertType != null and dto.insertType == 2 and dto.operatorId != null">
                AND insertType = 2
                AND addUserId = #{dto.operatorId}
            </if>
            <if test="dto.insertType != null and dto.insertType == 3 and dto.storeId != null">
                AND insertType = 3
                AND addUserId = #{dto.storeId}
            </if>
        </where>
        GROUP BY DATE_FORMAT(insertTime,'%Y')
    </select>
    <select id="getMonthUserCount" resultType="com.dsh.account.vo.entity.MonthData">
        select IFNULL(count(*),0) AS monthCount,DATE_FORMAT(insertTime,'%Y%m') AS `month`  from t_app_user
        <where>
            <if test="dto.cityCode != null and dto.cityCode != ''">
                AND cityCode = #{dto.cityCode}
            </if>
            <if test="dto.isVip != null">
                AND isVip = #{dto.isVip}
            </if>
            <if test="dto.insertType != null and dto.insertType == 2 and dto.operatorId != null">
                AND insertType = 2
                AND addUserId = #{dto.operatorId}
            </if>
            <if test="dto.insertType != null and dto.insertType == 3 and dto.storeId != null">
                AND insertType = 3
                AND addUserId = #{dto.storeId}
            </if>
        </where>
        GROUP BY DATE_FORMAT(insertTime,'%Y%m')
    </select>
    <select id="getWeekUserCount4" resultType="com.dsh.account.vo.entity.WeekData">
        select IFNULL(count(*),0) AS weekCount,4 AS `week`  from t_app_user
        <where>
            <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
                AND insertTime between #{dto.startTime} and #{dto.endTime}
            </if>
            <if test="dto.cityCode != null and dto.cityCode != ''">
                AND cityCode = #{dto.cityCode}
            </if>
            <if test="dto.isVip != null">
                AND isVip = #{dto.isVip}
            </if>
            <if test="dto.insertType != null and dto.insertType == 2 and dto.operatorId != null">
                AND insertType = 2
                AND addUserId = #{dto.operatorId}
            </if>
            <if test="dto.insertType != null and dto.insertType == 3 and dto.storeId != null">
                AND insertType = 3
                AND addUserId = #{dto.storeId}
            </if>
        </where>
    </select>
    <select id="getWeekUserCount3" resultType="com.dsh.account.vo.entity.WeekData">
        select IFNULL(count(*),0) AS weekCount,3 AS `week`  from t_app_user
        <where>
            <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
                AND insertTime between #{dto.startTime} and #{dto.endTime}
            </if>
            <if test="dto.cityCode != null and dto.cityCode != ''">
                AND cityCode = #{dto.cityCode}
            </if>
            <if test="dto.isVip != null">
                AND isVip = #{dto.isVip}
            </if>
            <if test="dto.insertType != null and dto.insertType == 2 and dto.operatorId != null">
                AND insertType = 2
                AND addUserId = #{dto.operatorId}
            </if>
            <if test="dto.insertType != null and dto.insertType == 3 and dto.storeId != null">
                AND insertType = 3
                AND addUserId = #{dto.storeId}
            </if>
        </where>
    </select>
    <select id="getWeekUserCount2" resultType="com.dsh.account.vo.entity.WeekData">
        select IFNULL(count(*),0) AS weekCount,2 AS `week`  from t_app_user
        <where>
            <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
                AND insertTime between #{dto.startTime} and #{dto.endTime}
            </if>
            <if test="dto.cityCode != null and dto.cityCode != ''">
                AND cityCode = #{dto.cityCode}
            </if>
            <if test="dto.isVip != null">
                AND isVip = #{dto.isVip}
            </if>
            <if test="dto.insertType != null and dto.insertType == 2 and dto.operatorId != null">
                AND insertType = 2
                AND addUserId = #{dto.operatorId}
            </if>
            <if test="dto.insertType != null and dto.insertType == 3 and dto.storeId != null">
                AND insertType = 3
                AND addUserId = #{dto.storeId}
            </if>
        </where>
    </select>
    <select id="getWeekUserCount1" resultType="com.dsh.account.vo.entity.WeekData">
        select IFNULL(count(*),0) AS weekCount,1 AS `week`  from t_app_user
        <where>
            <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
                AND insertTime between #{dto.startTime} and #{dto.endTime}
            </if>
            <if test="dto.cityCode != null and dto.cityCode != ''">
                AND cityCode = #{dto.cityCode}
            </if>
            <if test="dto.isVip != null">
                AND isVip = #{dto.isVip}
            </if>
            <if test="dto.insertType != null and dto.insertType == 2 and dto.operatorId != null">
                AND insertType = 2
                AND addUserId = #{dto.operatorId}
            </if>
            <if test="dto.insertType != null and dto.insertType == 3 and dto.storeId != null">
                AND insertType = 3
                AND addUserId = #{dto.storeId}
            </if>
        </where>
    </select>
    <select id="getDayUserCount" resultType="com.dsh.account.vo.entity.DayData">
        select IFNULL(count(*),0) AS dayCount,DATE_FORMAT(insertTime,'%Y-%m-%d') AS `day`  from t_app_user
        <where>
            <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
                AND insertTime between #{dto.startTime} and #{dto.endTime}
            </if>
            <if test="dto.cityCode != null and dto.cityCode != ''">
                AND cityCode = #{dto.cityCode}
            </if>
            <if test="dto.isVip != null">
                AND isVip = #{dto.isVip}
            </if>
            <if test="dto.insertType != null and dto.insertType == 2 and dto.operatorId != null">
                AND insertType = 2
                AND addUserId = #{dto.operatorId}
            </if>
            <if test="dto.insertType != null and dto.insertType == 3 and dto.storeId != null">
                AND insertType = 3
                AND addUserId = #{dto.storeId}
            </if>
        </where>
        GROUP BY DATE_FORMAT(insertTime,'%Y-%m-%d')
    </select>
    <select id="groupCityInfo" resultType="com.dsh.account.vo.GroupCityInfoVO">
        select IFNULL(count(*),0) AS userCount,cityCode,city  from t_app_user
        <where>
            <if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
                AND insertTime between #{dto.startTime} and #{dto.endTime}
            </if>
            <if test="dto.cityCode != null and dto.cityCode != ''">
                AND cityCode = #{dto.cityCode}
            </if>
            <if test="dto.isVip != null">
                AND isVip = #{dto.isVip}
            </if>
            <if test="dto.insertType != null and dto.insertType == 2 and dto.operatorId != null">
                AND insertType = 2
                AND addUserId = #{dto.operatorId}
            </if>
            <if test="dto.insertType != null and dto.insertType == 3 and dto.storeId != null">
                AND insertType = 3
                AND addUserId = #{dto.storeId}
            </if>
        </where>
        GROUP BY cityCode
    </select>
</mapper>