1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?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.txz.operating.dao.DayStatisticsMapper">
- <resultMap id="BaseResultMap" type="com.txz.operating.model.DayStatistics">
- <!--
- WARNING - @mbg.generated
- -->
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="dimension_id" jdbcType="BIGINT" property="dimensionId" />
- <result column="section_id" jdbcType="BIGINT" property="sectionId" />
- <result column="seq" jdbcType="INTEGER" property="seq" />
- <result column="section_name" jdbcType="VARCHAR" property="sectionName" />
- <result column="cut_day" jdbcType="DATE" property="cutDay" />
- <result column="statistics_value" jdbcType="DECIMAL" property="statisticsValue" />
- <result column="statistics_total" jdbcType="DECIMAL" property="statisticsTotal" />
- </resultMap>
- <select id="findStatisticsByCondition" resultType="com.txz.operating.web.bo.DayStatisticsBo">
- select sum(statistics_value) as statisticsValue,
- <choose>
- <when test="dataType != null and dataType == 2">
- DATE_FORMAT(cut_day, '%Y-%u') as cutDay
- </when>
- <when test="dataType != null and dataType == 3">
- DATE_FORMAT(cut_day, '%Y-%m') as cutDay
- </when>
- <when test="dataType != null and dataType == 4">
- DATE_FORMAT(cut_day, '%Y') as cutDay
- </when>
- <otherwise>
- cut_day as cutDay
- </otherwise>
- </choose>
- from r_day_statistics
- where section_id = #{sectionId} and cut_day between #{startTime} and #{endTime}
- GROUP BY
- <choose>
- <when test="dataType != null and dataType == 2">
- DATE_FORMAT(cut_day, '%Y-%u')
- </when>
- <when test="dataType != null and dataType == 3">
- DATE_FORMAT(cut_day, '%Y-%m')
- </when>
- <when test="dataType != null and dataType == 4">
- DATE_FORMAT(cut_day, '%Y')
- </when>
- <otherwise>
- cut_day
- </otherwise>
- </choose>
- order by cut_day
- </select>
- </mapper>
|