<?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.panzhihua.service_community.dao.ConvenientConsultationStatisticsDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientConsultationStatisticsDO">
|
<id column="id" property="id" />
|
<id column="merchant_id" property="merchantId" />
|
<id column="statistic_date" property="statisticDate" />
|
<id column="consultation_volume" property="consultationVolume" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id,merchant_id,statistic_date,consultation_volume
|
</sql>
|
<insert id="createTodayStatistic">
|
INSERT INTO com_convenient_consultation_statistics (merchant_id, statistic_date) VALUES (#{merchantId}, NOW())
|
</insert>
|
<update id="incrConsultationNum">
|
UPDATE com_convenient_consultation_statistics SET consultation_volume = consultation_volume + 1
|
WHERE merchant_id = #{merchantId} AND statistic_date = #{nowDate}
|
</update>
|
<select id="selectMonthConsultationVolume" resultType="java.lang.Integer">
|
SELECT IF(SUM(consultation_volume) IS NULL,0,SUM(consultation_volume))
|
FROM com_convenient_consultation_statistics
|
WHERE merchant_id = #{merchantId} AND (statistic_date LIKE CONCAT(#{moth}, '%') OR statistic_date IS NULL)
|
</select>
|
<select id="selectDayConsultationVolume" resultType="java.lang.Integer">
|
SELECT IF(SUM(consultation_volume) IS NULL,0,SUM(consultation_volume))
|
FROM com_convenient_consultation_statistics
|
WHERE merchant_id = #{merchantId} AND (statistic_date = #{day} OR statistic_date IS NULL)
|
</select>
|
<select id="selectSumForConsultationNum" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientConsultationStatisticsVO">
|
SELECT merchant_id, SUM(consultation_volume) AS totalConsultationNum
|
FROM com_convenient_consultation_statistics GROUP BY merchant_id
|
</select>
|
<select id="selectTotalConsultationVolume" resultType="java.lang.Integer">
|
SELECT IF(SUM(consultation_volume) IS NULL,0,SUM(consultation_volume))
|
FROM com_convenient_consultation_statistics
|
WHERE merchant_id = #{merchantId}
|
</select>
|
|
</mapper>
|