|
@@ -8,6 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="id" column="id" />
|
|
|
<result property="oneSystemAdd" column="one_system_add" />
|
|
|
<result property="twoSystemAdd" column="two_system_add" />
|
|
|
+ <result property="instantOneAmount" column="instant_one_amount" />
|
|
|
+ <result property="instantTwoAmount" column="instant_two_amount" />
|
|
|
<result property="oneAmount" column="one_amount" />
|
|
|
<result property="twoAmount" column="two_amount" />
|
|
|
<result property="tmpOneAmount" column="tmp_one_amount" />
|
|
@@ -137,4 +139,94 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="getNAddRecords" resultMap="TXlhtAddRecordResult">
|
|
|
select top ${counts} id, one_system_add, two_system_add, one_amount, two_amount, tmp_one_amount, tmp_two_amount, real_one_amount, real_two_amount, del_flag, revision, create_by, create_time, update_by, update_time, remark from t_xlht_add_record order by id desc
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectTXlhtAddRecordHourList" parameterType="TXlhtAddRecord" resultMap="TXlhtAddRecordResult">
|
|
|
+ SELECT
|
|
|
+ rec_hour.hour_time AS create_time,
|
|
|
+ sec_hour.instant_one_amount,
|
|
|
+ sec_hour.instant_two_amount,
|
|
|
+ rec_hour.one_amount,
|
|
|
+ rec_hour.two_amount,
|
|
|
+ rec_hour.tmp_one_amount,
|
|
|
+ rec_hour.tmp_two_amount,
|
|
|
+ rec_hour.real_one_amount,
|
|
|
+ rec_hour.real_two_amount
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0) AS hour_time,
|
|
|
+ avg(one_amount) AS one_amount,
|
|
|
+ avg(two_amount) AS two_amount,
|
|
|
+ avg(tmp_one_amount) AS tmp_one_amount,
|
|
|
+ avg(tmp_two_amount) AS tmp_two_amount,
|
|
|
+ avg(real_one_amount) AS real_one_amount,
|
|
|
+ avg(real_two_amount) AS real_two_amount
|
|
|
+ FROM t_xlht_add_record
|
|
|
+ <where>
|
|
|
+ 1 = 1
|
|
|
+ <if test="timeBegin != null and timeBegin != ''"> and create_time >= #{timeBegin}</if>
|
|
|
+ <if test="timeEnd != null and timeEnd != ''"> and create_time <= #{timeEnd}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0)
|
|
|
+ ) AS rec_hour
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0) AS hour_time,
|
|
|
+ AVG(one_amount) AS instant_one_amount,
|
|
|
+ AVG(two_amount) AS instant_two_amount
|
|
|
+ FROM t_xlht_add_record_sec
|
|
|
+ <where>
|
|
|
+ 1 = 1
|
|
|
+ <if test="timeBegin != null and timeBegin != ''"> and create_time >= #{timeBegin}</if>
|
|
|
+ <if test="timeEnd != null and timeEnd != ''"> and create_time <= #{timeEnd}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0)
|
|
|
+ ) AS sec_hour
|
|
|
+ ON sec_hour.hour_time = rec_hour.hour_time
|
|
|
+ order by rec_hour.hour_time desc
|
|
|
+ </select>
|
|
|
+ <select id="selectTXlhtAddRecordDayList" parameterType="TXlhtAddRecord" resultMap="TXlhtAddRecordResult">
|
|
|
+ SELECT
|
|
|
+ rec_day.day_time AS create_time,
|
|
|
+ sec_day.instant_one_amount,
|
|
|
+ sec_day.instant_two_amount,
|
|
|
+ rec_day.one_amount,
|
|
|
+ rec_day.two_amount,
|
|
|
+ rec_day.tmp_one_amount,
|
|
|
+ rec_day.tmp_two_amount,
|
|
|
+ rec_day.real_one_amount,
|
|
|
+ rec_day.real_two_amount
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ CAST(create_time AS DATE) AS day_time,
|
|
|
+ avg(one_amount) AS one_amount,
|
|
|
+ avg(two_amount) AS two_amount,
|
|
|
+ avg(tmp_one_amount) AS tmp_one_amount,
|
|
|
+ avg(tmp_two_amount) AS tmp_two_amount,
|
|
|
+ avg(real_one_amount) AS real_one_amount,
|
|
|
+ avg(real_two_amount) AS real_two_amount
|
|
|
+ FROM t_xlht_add_record
|
|
|
+ <where>
|
|
|
+ 1 = 1
|
|
|
+ <if test="timeBegin != null and timeBegin != ''"> and create_time >= #{timeBegin}</if>
|
|
|
+ <if test="timeEnd != null and timeEnd != ''"> and create_time <= #{timeEnd}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY CAST(create_time AS DATE)
|
|
|
+ ) AS rec_day
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ CAST(create_time AS DATE) AS day_time,
|
|
|
+ AVG(one_amount) AS instant_one_amount,
|
|
|
+ AVG(two_amount) AS instant_two_amount
|
|
|
+ FROM t_xlht_add_record_sec
|
|
|
+ <where>
|
|
|
+ 1 = 1
|
|
|
+ <if test="timeBegin != null and timeBegin != ''"> and create_time >= #{timeBegin}</if>
|
|
|
+ <if test="timeEnd != null and timeEnd != ''"> and create_time <= #{timeEnd}</if>
|
|
|
+ </where>
|
|
|
+ GROUP BY CAST(create_time AS DATE)
|
|
|
+ ) AS sec_day
|
|
|
+ ON sec_day.day_time = rec_day.day_time
|
|
|
+ order by rec_day.day_time desc;
|
|
|
+ </select>
|
|
|
</mapper>
|