293 lines
12 KiB
XML
293 lines
12 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">
|
||
|
|
<!--suppress ALL -->
|
||
|
|
<mapper namespace="com.xhpc.databigscreen.mapper.XhpcRateTimeMapper">
|
||
|
|
<resultMap id="BaseResultMap" type="com.xhpc.databigscreen.pojo.XhpcRateTime">
|
||
|
|
<id column="rate_time_id" jdbcType="BIGINT" property="rateTimeId"/>
|
||
|
|
<result column="charging_station_id" jdbcType="BIGINT" property="chargingStationId"/>
|
||
|
|
<result column="rate_id" jdbcType="BIGINT" property="rateId"/>
|
||
|
|
<result column="start_time" jdbcType="TIME" property="startTime"/>
|
||
|
|
<result column="end_time" jdbcType="TIME" property="endTime"/>
|
||
|
|
<result column="status" jdbcType="INTEGER" property="status"/>
|
||
|
|
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
|
||
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
|
||
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
|
||
|
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||
|
|
<result column="rate_model_id" jdbcType="BIGINT" property="rateModelId"/>
|
||
|
|
<result column="sort" jdbcType="INTEGER" property="sort"/>
|
||
|
|
<result column="type" jdbcType="INTEGER" property="type"/>
|
||
|
|
<result column="rate_value" jdbcType="VARCHAR" property="rateValue"/>
|
||
|
|
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
|
||
|
|
</resultMap>
|
||
|
|
<sql id="Base_Column_List">
|
||
|
|
rate_time_id
|
||
|
|
, charging_station_id, rate_id, start_time, end_time, `status`, del_flag,
|
||
|
|
create_time, create_by, update_time, update_by, remark, rate_model_id, sort, `type`,
|
||
|
|
rate_value, tenant_id
|
||
|
|
</sql>
|
||
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from xhpc_rate_time
|
||
|
|
where rate_time_id = #{rateTimeId,jdbcType=BIGINT}
|
||
|
|
</select>
|
||
|
|
<select id="selectByTenantIdsAndCharingStationIds" resultType="Map">
|
||
|
|
select
|
||
|
|
r.charging_order_id chargingOrderId,
|
||
|
|
ROUND(r.charging_degree,2) as chargingDegree,
|
||
|
|
r.amount_charged amountCharged,
|
||
|
|
r.electric_current electricCurrent,
|
||
|
|
r.voltage,
|
||
|
|
r.soc,
|
||
|
|
r.source,
|
||
|
|
DATE_FORMAT(o.start_time,"%H:%m") as startTime,
|
||
|
|
CASE r.source
|
||
|
|
WHEN 0 THEN
|
||
|
|
"C端用户"
|
||
|
|
WHEN 2 THEN
|
||
|
|
"社区用户"
|
||
|
|
WHEN 3 THEN
|
||
|
|
"B端用户"
|
||
|
|
END sourceMap,
|
||
|
|
r.charging_time chargingTime,
|
||
|
|
CONCAT(o.charging_mode,"用户") as chargingMode
|
||
|
|
from
|
||
|
|
(SELECT
|
||
|
|
charging_order_id,
|
||
|
|
charging_degree,
|
||
|
|
amount_charged,
|
||
|
|
electric_current,
|
||
|
|
voltage,
|
||
|
|
soc,
|
||
|
|
source,
|
||
|
|
tenant_id,
|
||
|
|
charging_time
|
||
|
|
FROM
|
||
|
|
xhpc_real_time_order
|
||
|
|
WHERE
|
||
|
|
real_time_order_id IN
|
||
|
|
(SELECT
|
||
|
|
max(real_time_order_id)
|
||
|
|
FROM
|
||
|
|
xhpc_real_time_order
|
||
|
|
WHERE
|
||
|
|
charging_order_id IN
|
||
|
|
(SELECT charge_order_id FROM xhpc_charge_order WHERE STATUS = 0 and del_flag = 0
|
||
|
|
<if test="tenantIdList!=null and tenantIdList.size()!=0">
|
||
|
|
and tenant_id in
|
||
|
|
<foreach collection="tenantIdList" open="(" close=")" separator="," item="tenantId">
|
||
|
|
#{tenantId}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
<if test="xhpcChargingStationList!=null and xhpcChargingStationList.size()!=0">
|
||
|
|
and charging_station_id in
|
||
|
|
<foreach collection="xhpcChargingStationList" open="(" close=")" separator="," item="chargingStationId">
|
||
|
|
#{chargingStationId}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
)
|
||
|
|
GROUP BY charging_order_id))
|
||
|
|
AS r LEFT JOIN xhpc_charge_order as o on r.charging_order_id = o.charge_order_id
|
||
|
|
ORDER BY o.start_time ASC
|
||
|
|
</select>
|
||
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||
|
|
delete
|
||
|
|
from xhpc_rate_time
|
||
|
|
where rate_time_id = #{rateTimeId,jdbcType=BIGINT}
|
||
|
|
</delete>
|
||
|
|
<insert id="insert" keyColumn="rate_time_id" keyProperty="rateTimeId"
|
||
|
|
parameterType="com.xhpc.databigscreen.pojo.XhpcRateTime" useGeneratedKeys="true">
|
||
|
|
insert into xhpc_rate_time (charging_station_id, rate_id, start_time,
|
||
|
|
end_time, `status`, del_flag,
|
||
|
|
create_time, create_by, update_time,
|
||
|
|
update_by, remark, rate_model_id,
|
||
|
|
sort, `type`, rate_value,
|
||
|
|
tenant_id)
|
||
|
|
values (#{chargingStationId,jdbcType=BIGINT}, #{rateId,jdbcType=BIGINT}, #{startTime,jdbcType=TIME},
|
||
|
|
#{endTime,jdbcType=TIME}, #{status,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER},
|
||
|
|
#{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
|
||
|
|
#{updateBy,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{rateModelId,jdbcType=BIGINT},
|
||
|
|
#{sort,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{rateValue,jdbcType=VARCHAR},
|
||
|
|
#{tenantId,jdbcType=VARCHAR})
|
||
|
|
</insert>
|
||
|
|
<insert id="insertSelective" keyColumn="rate_time_id" keyProperty="rateTimeId"
|
||
|
|
parameterType="com.xhpc.databigscreen.pojo.XhpcRateTime" useGeneratedKeys="true">
|
||
|
|
insert into xhpc_rate_time
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="chargingStationId != null">
|
||
|
|
charging_station_id,
|
||
|
|
</if>
|
||
|
|
<if test="rateId != null">
|
||
|
|
rate_id,
|
||
|
|
</if>
|
||
|
|
<if test="startTime != null">
|
||
|
|
start_time,
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
end_time,
|
||
|
|
</if>
|
||
|
|
<if test="status != null">
|
||
|
|
`status`,
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null">
|
||
|
|
del_flag,
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
create_time,
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null">
|
||
|
|
create_by,
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null">
|
||
|
|
update_time,
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null">
|
||
|
|
update_by,
|
||
|
|
</if>
|
||
|
|
<if test="remark != null">
|
||
|
|
remark,
|
||
|
|
</if>
|
||
|
|
<if test="rateModelId != null">
|
||
|
|
rate_model_id,
|
||
|
|
</if>
|
||
|
|
<if test="sort != null">
|
||
|
|
sort,
|
||
|
|
</if>
|
||
|
|
<if test="type != null">
|
||
|
|
`type`,
|
||
|
|
</if>
|
||
|
|
<if test="rateValue != null">
|
||
|
|
rate_value,
|
||
|
|
</if>
|
||
|
|
<if test="tenantId != null">
|
||
|
|
tenant_id,
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="chargingStationId != null">
|
||
|
|
#{chargingStationId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="rateId != null">
|
||
|
|
#{rateId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="startTime != null">
|
||
|
|
#{startTime,jdbcType=TIME},
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
#{endTime,jdbcType=TIME},
|
||
|
|
</if>
|
||
|
|
<if test="status != null">
|
||
|
|
#{status,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null">
|
||
|
|
#{delFlag,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
#{createTime,jdbcType=TIMESTAMP},
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null">
|
||
|
|
#{createBy,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null">
|
||
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null">
|
||
|
|
#{updateBy,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="remark != null">
|
||
|
|
#{remark,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="rateModelId != null">
|
||
|
|
#{rateModelId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="sort != null">
|
||
|
|
#{sort,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="type != null">
|
||
|
|
#{type,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="rateValue != null">
|
||
|
|
#{rateValue,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="tenantId != null">
|
||
|
|
#{tenantId,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.databigscreen.pojo.XhpcRateTime">
|
||
|
|
update xhpc_rate_time
|
||
|
|
<set>
|
||
|
|
<if test="chargingStationId != null">
|
||
|
|
charging_station_id = #{chargingStationId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="rateId != null">
|
||
|
|
rate_id = #{rateId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="startTime != null">
|
||
|
|
start_time = #{startTime,jdbcType=TIME},
|
||
|
|
</if>
|
||
|
|
<if test="endTime != null">
|
||
|
|
end_time = #{endTime,jdbcType=TIME},
|
||
|
|
</if>
|
||
|
|
<if test="status != null">
|
||
|
|
`status` = #{status,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="delFlag != null">
|
||
|
|
del_flag = #{delFlag,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null">
|
||
|
|
create_by = #{createBy,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="updateTime != null">
|
||
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||
|
|
</if>
|
||
|
|
<if test="updateBy != null">
|
||
|
|
update_by = #{updateBy,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="remark != null">
|
||
|
|
remark = #{remark,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="rateModelId != null">
|
||
|
|
rate_model_id = #{rateModelId,jdbcType=BIGINT},
|
||
|
|
</if>
|
||
|
|
<if test="sort != null">
|
||
|
|
sort = #{sort,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="type != null">
|
||
|
|
`type` = #{type,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="rateValue != null">
|
||
|
|
rate_value = #{rateValue,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="tenantId != null">
|
||
|
|
tenant_id = #{tenantId,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
</set>
|
||
|
|
where rate_time_id = #{rateTimeId,jdbcType=BIGINT}
|
||
|
|
</update>
|
||
|
|
<update id="updateByPrimaryKey" parameterType="com.xhpc.databigscreen.pojo.XhpcRateTime">
|
||
|
|
update xhpc_rate_time
|
||
|
|
set charging_station_id = #{chargingStationId,jdbcType=BIGINT},
|
||
|
|
rate_id = #{rateId,jdbcType=BIGINT},
|
||
|
|
start_time = #{startTime,jdbcType=TIME},
|
||
|
|
end_time = #{endTime,jdbcType=TIME},
|
||
|
|
`status` = #{status,jdbcType=INTEGER},
|
||
|
|
del_flag = #{delFlag,jdbcType=INTEGER},
|
||
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||
|
|
create_by = #{createBy,jdbcType=VARCHAR},
|
||
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||
|
|
update_by = #{updateBy,jdbcType=VARCHAR},
|
||
|
|
remark = #{remark,jdbcType=VARCHAR},
|
||
|
|
rate_model_id = #{rateModelId,jdbcType=BIGINT},
|
||
|
|
sort = #{sort,jdbcType=INTEGER},
|
||
|
|
`type` = #{type,jdbcType=INTEGER},
|
||
|
|
rate_value = #{rateValue,jdbcType=VARCHAR},
|
||
|
|
tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||
|
|
where rate_time_id = #{rateTimeId,jdbcType=BIGINT}
|
||
|
|
</update>
|
||
|
|
</mapper>
|