105 lines
3.5 KiB
XML
105 lines
3.5 KiB
XML
|
|
<?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.ho.business.mapper.EarningsCalculateMpptMapper">
|
||
|
|
|
||
|
|
|
||
|
|
<delete id="deleteByDay">
|
||
|
|
delete
|
||
|
|
from earnings_calculate_mppt
|
||
|
|
<where>
|
||
|
|
and day = #{day}
|
||
|
|
<if test="typeList !=null and typeList.size() !=0">
|
||
|
|
and type in
|
||
|
|
<foreach collection="typeList" item="item" open="(" close=")" separator=",">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<insert id="insertBatch">
|
||
|
|
INSERT INTO earnings_calculate_mppt
|
||
|
|
(group_id, pid, station_id, src_id, dept_id, create_time, day, type,
|
||
|
|
digital,elec,rate_type,price,total,discount)
|
||
|
|
VALUES
|
||
|
|
<foreach item="item" collection="list" index="index" separator=",">
|
||
|
|
(
|
||
|
|
#{item.groupId},#{item.pid},#{item.stationId},#{item.srcId},#{item.deptId}, now(),
|
||
|
|
#{item.day},#{item.type},#{item.digital},#{item.elec},#{item.rateType},#{item.price},#{item.total},#{item.discount}
|
||
|
|
)
|
||
|
|
</foreach>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<select id="countPvIncome" resultType="com.ho.business.vo.resp.InverterResp.PowerGenerateRespVO">
|
||
|
|
SELECT DAY date,sum( digital ) profit
|
||
|
|
FROM
|
||
|
|
earnings_calculate_mppt
|
||
|
|
WHERE
|
||
|
|
station_id = #{stationId}
|
||
|
|
AND DAY BETWEEN #{beginTime}
|
||
|
|
AND #{endTime}
|
||
|
|
GROUP BY DAY
|
||
|
|
</select>
|
||
|
|
<select id="countAllPvIncome" resultType="java.math.BigDecimal">
|
||
|
|
SELECT sum( digital )
|
||
|
|
FROM
|
||
|
|
earnings_calculate_mppt
|
||
|
|
WHERE
|
||
|
|
station_id = #{stationId}
|
||
|
|
<if test="beginTime != null">
|
||
|
|
and day >= #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
and day <= #{endTime}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
<select id="getProfit" resultType="com.ho.business.vo.resp.profit.DayProfitType">
|
||
|
|
select
|
||
|
|
station_id,day,type,sum(digital) as digital
|
||
|
|
from earnings_calculate_mppt
|
||
|
|
<where>
|
||
|
|
digital > 0
|
||
|
|
<if test="groupId != null">
|
||
|
|
and group_id = #{groupId}
|
||
|
|
</if>
|
||
|
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
||
|
|
and day BETWEEN #{beginTime}
|
||
|
|
AND #{endTime}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
group by station_id, day,type
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getFirstTime" resultType="java.lang.String">
|
||
|
|
SELECT min(day) day
|
||
|
|
FROM earnings_calculate_mppt;
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getEarningsByParam" resultType="com.ho.business.vo.resp.profit.DayProfitType">
|
||
|
|
select
|
||
|
|
station_id,day,type,sum(digital) as digital
|
||
|
|
from earnings_calculate_mppt
|
||
|
|
<where>
|
||
|
|
digital > 0
|
||
|
|
<if test="groupId != null">
|
||
|
|
and group_id = #{groupId}
|
||
|
|
</if>
|
||
|
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
||
|
|
and day BETWEEN #{beginTime}
|
||
|
|
AND #{endTime}
|
||
|
|
</if>
|
||
|
|
<if test="stationIds != null and stationIds.size() != 0">
|
||
|
|
and station_id in
|
||
|
|
<foreach collection="stationIds" item="item" open="(" close=")" separator=",">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
group by station_id, day,type
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|