431 lines
23 KiB
XML
Raw Normal View History

2021-12-31 10:37:40 +08:00
<?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">
2022-02-22 10:49:25 +08:00
<mapper namespace="com.xhpc.pp.mapper.XhpcDeviceMessageMapper">
2021-12-31 10:37:40 +08:00
<resultMap type="com.xhpc.pp.domain.XhpcDeviceMessage" id="XhpcDeviceMessageResult">
<id property="deviceMessageId" column="device_message_id"/>
<result property="type" column="type"/>
<result property="serialNumber" column="serial_number"/>
<result property="content" column="content"/>
<result property="chargeOrderNo" column="charge_order_no"/>
2021-12-31 10:37:40 +08:00
<result property="status" column="status"/>
<result property="gunStatus" column="gun_status"/>
<result property="gunNumber" column="gun_number"/>
2021-12-31 10:37:40 +08:00
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
</resultMap>
2023-09-15 15:09:04 +08:00
<resultMap id="BaseResultMap" type="com.xhpc.evcs.domain.XhpcChargingPile">
<result property="id" column="charging_pile_id"/>
<result property="chargingStationId" column="charging_station_id"/>
<result property="name" column="name"/>
<result property="nationalStandard" column="national_standard"/>
<result property="power" column="power"/>
<result property="auxiliaryPowerSupply" column="auxiliary_power_supply"/>
<result property="inputVoltage" column="input_voltage"/>
<result property="maxVoltage" column="max_voltage"/>
<result property="minVoltage" column="min_voltage"/>
<result property="maxElectricCurrent" column="max_electric_current"/>
<result property="minElectricCurrent" column="min_electric_current"/>
<result property="serialNumber" column="serial_number"/>
<result property="type" column="type"/>
<result property="programVersion" column="program_version"/>
<result property="networkLinkType" column="network_link_type"/>
<result property="gunNumber" column="gun_number"/>
<result property="communicationProtocolVersion" column="communication_protocol_version"/>
<result property="communicationOperator" column="communication_operator"/>
<result property="simCard" column="sim_card"/>
<result property="rateModelId" column="rate_model_id"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
<result property="brandModel" column="brand_model"/>
<result property="manufactureName" column="manufacture_name"/>
<result property="connectorType" column="connector_type"/>
<result property="equipmentType" column="equipment_type"/>
<result property="current" column="current"/>
<result property="searchValue" column="search_value"/>
<result property="equipmentProductCode" column="equipment_product_code"/>
<result property="transformerID" column="transformer_id"/>
<result property="newNationalStandard" column="new_national_standard"/>
<result property="vinFlag" column="vin_flag"/>
<result property="equipmentStatus" column="equipment_status"/>
<result property="equipmentPurpose" column="equipment_purpose"/>
<result property="manufacturerId" column="manufacturer_id"/>
</resultMap>
2021-12-31 10:37:40 +08:00
<insert id="insertByDomain" parameterType="com.xhpc.pp.domain.XhpcDeviceMessage">
insert into xhpc_device_message(
2022-01-13 09:48:20 +08:00
<if test="type != null">type,</if>
2021-12-31 10:37:40 +08:00
<if test="serialNumber != null and serialNumber != 0">serial_number,</if>
<if test="content != null and content != ''">content,</if>
<if test="chargeOrderNo != null and chargeOrderNo != ''">charge_order_no,</if>
2021-12-31 10:37:40 +08:00
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="gunStatus != null">gun_status,</if>
<if test="gunNumber != null">gun_number,</if>
2021-12-31 10:37:40 +08:00
create_time,
update_time
)values(
2022-01-13 10:44:50 +08:00
<if test="type != null">#{type},</if>
2021-12-31 10:37:40 +08:00
<if test="serialNumber != null and serialNumber != 0">#{serialNumber},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="chargeOrderNo != null and chargeOrderNo != ''">#{chargeOrderNo},</if>
2021-12-31 10:37:40 +08:00
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="gunStatus != null">#{gunStatus},</if>
<if test="gunNumber != null">#{gunNumber},</if>
2021-12-31 10:37:40 +08:00
sysdate(),
sysdate()
)
</insert>
<insert id="insertChargingPileStatus">
insert into xhpc_charging_pile_status(
<if test="serialNumber != null and serialNumber != ''">serial_number,</if>
<if test="pileSerialNumber != null and pileSerialNumber != ''">pile_serial_number,</if>
<if test="stationId != null and stationId != ''">station_id,</if>
<if test="statusName != null and statusName != ''">status_name,</if>
create_time,
update_time
)values(
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
<if test="pileSerialNumber != null and pileSerialNumber != ''">#{pileSerialNumber},</if>
<if test="stationId != null and stationId != ''">#{stationId},</if>
<if test="statusName != null and statusName != ''">#{statusName},</if>
sysdate(),
sysdate()
)
</insert>
2021-12-31 10:37:40 +08:00
<delete id="deleteByLastThreeMonth">
delete from xhpc_message
where create_time <![CDATA[ <= ]]> #{expireDate};
</delete>
2023-09-15 15:09:04 +08:00
<select id="getXhpcChargingPile" parameterType="com.xhpc.evcs.domain.XhpcChargingPile"
resultType="com.xhpc.evcs.domain.XhpcChargingPile">
select
xcp.charging_pile_id as id,
xcp.charging_station_id as chargingStationId,
xcp.name name,
xcp.national_standard as nationalStandard,
xcp.power power,
xcp.auxiliary_power_supply auxiliaryPowerSupply,
xcp.input_voltage inputVoltage,
xcp.max_voltage maxVoltage,
xcp.min_voltage minVoltage,
xcp.max_electric_current maxElectricCurrent,
xcp.min_electric_current minElectricCurrent,
xcp.serial_number serialNumber,
xcp.type type,
xcp.program_version programVersion,
xcp.network_link_type networkLinkType,
xcp.gun_number gunNumber,
xcp.communication_protocol_version communicationProtocolVersion,
xcp.communication_operator communicationOperator,
xcp.sim_card simCard,
xcp.status status,
xcp.del_flag delFlag,
xcp.rate_model_id rateModelId,
xcp.brand_model brandModel,
date_format(xcp.production_date,'%Y-%m-%d') productionDate,
xcp.manufacture_name manufactureName,
xcp.connector_type connectorType,
xcp.equipment_type equipmentType,
xcp.current as current,
xcp.search_value searchValue,
xcp.equipment_product_code equipmentProductCode,
xcp.transformer_id transformerID,
xcp.new_national_standard newNationalStandard,
xcp.vin_flag vinFlag,
xcp.equipment_status equipmentStatus,
xcp.equipment_purpose equipmentPurpose,
xcp.manufacturer_id manufacturerId,
2023-10-16 16:47:42 +08:00
xcp.equipment_classificatlon equipmentClassificatlon,
xcp.aux_power auxPower,
2023-09-15 15:09:04 +08:00
date_format(xcs.construction_time,'%Y-%m-%d') as constructionTime
from xhpc_charging_pile xcp
left join xhpc_charging_station xcs on xcs.charging_station_id = xcp.charging_station_id
2023-09-15 15:09:04 +08:00
where xcp.serial_number =#{pileNo} and xcp.del_flag =0 limit 1
</select>
2023-09-15 15:09:04 +08:00
<select id="getXhpcChargingStation" parameterType="com.xhpc.evcs.cdjgpc.dto.CDStationInfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDStationInfo">
select CAST(ct.charging_station_id AS CHAR(10)) as stationId,
ct.chengdu_name as stationName,
2023-09-15 15:09:04 +08:00
ct.operator_id_evcs as operatorId,
ct.internet_equipment_owner_id as equipmentOwnerId,
2023-09-15 15:09:04 +08:00
ct.is_alone_apply as isAloneApply,
ct.account_number as accountNumber,
ct.capacity as capacity,
ct.country_code as countryCcode,
CAST(ct.area_code AS CHAR(10)) as areaCode,
2023-10-16 16:47:42 +08:00
ct.area_code_countryside as areaCodeCountryside,
2023-09-15 15:09:04 +08:00
ct.address as address,
ct.service_tel as serviceTel,
ct.station_type as stationType,
ct.is_open as isOpen,
ct.station_status as stationStatus,
ct.park_nums as parkNums,
ROUND(ct.longitude,6) as stationLng,
ROUND(ct.latitude,6) as stationLat,
ct.construction_site as construction,
2023-10-16 16:47:42 +08:00
ct.swap_match_cars_name as swapMatchCarsName,
2023-09-15 15:09:04 +08:00
ct.open_all_day as openAllDay,
ct.busine_hours as busineHours,
2023-10-16 16:47:42 +08:00
ct.electricity_fee as electricityFee,
2023-09-15 15:09:04 +08:00
ct.service_fee as serviceFee,
ct.park_free as parkFree,
ct.park_fee as parkFee,
ct.payment as payment,
ct.park_fee_type as parkFeeType,
ct.toilet_flag as toiletFlag,
ct.store_flag as storeFlag,
ct.lounge_flag as loungeFlag,
ct.canopy_flag as canopyFlag,
ct.printer_flag as printerFlag,
ct.barrier_flag as barrierFlag,
ct.parking_lock_flag as parkingLockFlag,
ct.is_demand_response as isDemandResponse,
ct.is_support_orderly_charging as isSupportOrderlyCharging,
2023-10-16 16:47:42 +08:00
ct.is_energy_storage as isEnergyStorage,
ct.station_classification as stationClassification,
ct.general_application_type as generalApplicationType,
ct.round_the_clock as roundTheClock,
ct.park_type as parkType,
ct.electncity_type as electncityType,
ct.business_expand_type as businessExpandType,
ct.rated_power as ratedPower,
ct.period_fee as periodFee,
ct.official_run_time as officialRunTime,
ct.video_monitor as videoMonitor
2023-09-15 15:09:04 +08:00
from xhpc_charging_station as ct
where ct.charging_station_id = #{chargingStationId}
and ct.del_flag = 0
</select>
2023-10-16 16:47:42 +08:00
<select id="getConnectorEquipmentElectricity" resultType="double">
select
round(ifnull(sum(xho.total_power),0),1)as connectorElectricity
from xhpc_history_order xho
where xho.charging_station_id =#{stationId}
and date_format(xho.end_time,'%Y-%m-%d') &gt;=#{startTime} and date_format(xho.end_time,'%Y-%m-%d') &lt;=#{endTime}
and xho.terminal_id =#{terminalId}
2023-10-16 16:47:42 +08:00
</select>
<select id="getEquipmentEquipmentElectricity" resultType="double">
select
round(ifnull(sum(total_power),0),1)as connectorElectricity
from xhpc_history_order
where terminal_id in(select terminal_id from xhpc_terminal where charging_pile_id =#{chargingPileId} and charging_station_id =#{stationId} and del_flag=0)
and charging_station_id =#{stationId} and date_format(end_time,'%Y-%m-%d') &gt;=#{startTime} and date_format(end_time,'%Y-%m-%d') &lt;=#{endTime}
2023-10-16 16:47:42 +08:00
</select>
<select id="getStationEquipmentElectricity" parameterType="com.xhpc.evcs.cdjgpc.dto.CDStationStatslnfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDStationStatslnfo">
select
xco.charging_station_id as stationID,
round(sum(xco.charging_degree),1) as stationElectricity,
xcs.station_classification as stationClassification,
count(xco.charge_order_id) as stationTotalChargeNum,
round(sum(xco.charging_time_number/60),2) as stationTotalChargeTime,
sum(xco.station_total_warning_num) as stationTotalWarningNum,
xo.operator_id_evcs as operatorID,
xcs.equipment_owner_id as equipmentOnwerID
from xhpc_charge_order xco
left join xhpc_charging_station xcs on xcs.charging_station_id = xco.charging_station_id
left join xhpc_operator xo on xo.operator_id = xcs.operator_id
2023-10-16 16:47:42 +08:00
where xco.charging_station_id =#{stationId}
and date_format(xco.end_time,'%Y-%m-%d') &gt;=#{startTime} and date_format(xco.end_time,'%Y-%m-%d') &lt;=#{endTime}
GROUP BY xco.charging_station_id
</select>
<select id="getSupEquipmentStatsInfo" parameterType="com.xhpc.evcs.cdjgpc.dto.CDSuqEquipmentStatslnfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDSuqEquipmentStatslnfo">
select
xcp.serial_number as equipmentID,
xcp.equipment_classificatlon as equipmentClassification,
round(sum(xco.charging_degree),2) as equipmentElectncity,
round(sum(xco.charging_time_number/60),0) as equipmentTotalChargeTime,
count(xco.charge_order_id) as equipmentTotalChargeNum,
sum(xco.station_total_warning_num) as equipmentTotalWarningNum
from xhpc_charge_order xco
left join xhpc_charging_station xcs on xcs.charging_station_id = xco.charging_station_id
left join xhpc_operator xo on xo.operator_id = xcs.operator_id
left join xhpc_terminal xt on xco.terminal_id = xt.terminal_id
left join xhpc_charging_pile xcp on xt.charging_pile_id = xcp.charging_pile_id
2023-10-16 16:47:42 +08:00
where xco.charging_station_id =#{stationId} and xco.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id =#{chargingPileId})
and xco.end_time &gt;=#{startTime} and xco.end_time &lt;=#{endTime}
</select>
<select id="getSupConnectorStatslnfo" parameterType="com.xhpc.evcs.cdjgpc.dto.CDSupConnectorStatslnfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDSupConnectorStatslnfo">
select
xt.serial_number as connectorID,
xcp.equipment_classificatlon as equipmentClassification,
round(sum(xco.charging_degree),2) as connectorElectricity,
round(sum(xco.charging_time_number/60),0) as connectorTotalChargeTime,
count(xco.charge_order_id) as connectorTotalChargeNum,
sum(xco.station_total_warning_num) as connectorTotalWarningNum
2023-10-16 16:47:42 +08:00
from xhpc_charge_order xco
left join xhpc_charging_station xcs on xcs.charging_station_id = xco.charging_station_id
left join xhpc_terminal xt on xco.terminal_id = xt.terminal_id
left join xhpc_charging_pile xcp on xt.charging_pile_id = xcp.charging_pile_id
2023-10-16 16:47:42 +08:00
where xco.charging_station_id =#{stationId}
<if test="chargingPileId !=null">
and xco.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id =#{chargingPileId})
</if>
and xco.end_time &gt;=#{startTime} and xco.end_time &lt;=#{endTime}
2023-10-16 16:47:42 +08:00
GROUP BY xco.terminal_id
</select>
<select id="getStationId" resultType="long">
select charging_station_id chargingStationId
from xhpc_charging_station where charging_station_id not in (select charging_station_id from xhpc_station_internet_blacklist where internet_user_id =(
select internet_user_id from xhpc_internet_user where operator_id_evcs =#{operatorIdEvcs} LIMIT 1) )
</select>
<select id="getchargingPileId" resultType="long">
select charging_pile_id chargingPileId
from xhpc_charging_pile where charging_station_id =#{stationId} and del_flag =0
</select>
<select id="getterminalId" resultType="long">
SELECT
xt.terminal_id as connectorID
from xhpc_terminal xt
where xt.charging_pile_id =#{chargingPileId} and xt.charging_station_id=#{stationId} and xt.del_flag=0
</select>
<select id="getNotificationStationFee" parameterType="com.xhpc.evcs.cdjgpc.dto.CDChargeFeeDetail"
resultType="com.xhpc.evcs.cdjgpc.dto.CDChargeFeeDetail">
SELECT
DATE_FORMAT(xrt.start_time,'%H:%i') startTime,
replace(DATE_FORMAT(xrt.end_time,'%H:%i'),'00:00','23:59') endTime,
xr.power_fee electricityFee,
xr.service_fee serviceFee,
xcs.equipment_type equipmentType
from xhpc_rate_time xrt
LEFT JOIN xhpc_rate xr on xrt.rate_id = xr.rate_id
LEFT JOIN xhpc_charging_station xcs on xcs.charging_station_id = xrt.charging_station_id
2023-10-16 16:47:42 +08:00
where xrt.charging_station_id=#{stationId} and xrt.del_flag =0
</select>
<select id="getSuperviseQueryStationPowerInfo" parameterType="com.xhpc.evcs.cdjgpc.dto.CDSupStationPowerInfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDSupStationPowerInfo">
select
xcs.operator_id_evcs as operatorlD,
xcs.equipment_owner_id as equipmentOnwerID,
xcs.charging_station_id as stationID,
xcs.station_classification as stationClassification,
ADDTIME(NOW(),10) dataTime,
ROUND(sum(xcsp.voltage*xcsp.current),1)as stationRealTimePower
from xhpc_charging_station_power as xcsp
left join xhpc_charging_station as xcs on xcs.charging_station_id = xcsp.charging_station_id
where xcsp.del_flag = 0
and DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') &gt;=#{subTime}
and DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') &lt;= #{subTime}
and xcsp.status =#{number} and xcsp.charging_station_id in
<foreach collection="stationIds" item="stationId" open="(" close=")" separator=",">
#{stationId}
</foreach>
GROUP BY xcsp.charging_station_id,DATE_FORMAT(xcsp.create_time,'%Y-%m-%d')
ORDER BY DATE_FORMAT(xcsp.create_time,'%Y-%m-%d'),xcsp.charging_station_id
2023-10-16 16:47:42 +08:00
</select>
<select id="getPileSuperviseQueryStationPowerInfo" parameterType="com.xhpc.evcs.cdjgpc.dto.CDSupEquipmentPowerInfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDSupEquipmentPowerInfo">
select
xcp.charging_pile_id as pileID,
xcp.serial_number as equipmentID,
xcp.equipment_classificatlon as equipmentClassification,
ADDTIME(NOW(),10) dataTime,
ROUND(sum(xcsp.voltage*xcsp.current), 1)as equipRealTimePower
from xhpc_charging_station_power as xcsp
left join xhpc_charging_station as xcs on xcs.charging_station_id = xcsp.charging_station_id
left join xhpc_charging_pile as xcp on xcp.charging_pile_id = xcsp.charging_pile_id
2023-10-16 16:47:42 +08:00
where xcsp.del_flag = 0
and DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') &gt;=#{subTime}
and DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') &lt;= #{subTime}
and xcsp.status =#{number}
and xcsp.charging_station_id =#{chargingStationId}
GROUP BY xcsp.charging_pile_id,DATE_FORMAT(xcsp.create_time,'%Y-%m-%d')
ORDER BY DATE_FORMAT(xcsp.create_time,'%Y-%m-%d'),xcsp.charging_pile_id
</select>
<select id="getTerminalSuperviseQueryStationPowerInfo" parameterType="com.xhpc.evcs.cdjgpc.dto.CDSupConnectorPowerInfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDSupConnectorPowerInfo">
select
xt.serial_number as connectorID,
xcp.equipment_classificatlon as equipmentClassification,
ADDTIME(NOW(),10) dataTime,
ROUND(sum(xcsp.voltage*xcsp.current), 1)as connectorRealTimePower
from xhpc_charging_station_power as xcsp
left join xhpc_charging_station as xcs on xcs.charging_station_id = xcsp.charging_station_id
left join xhpc_charging_pile as xcp on xcp.charging_pile_id = xcsp.charging_pile_id
left join xhpc_terminal as xt on xt.terminal_id = xcsp.terminal_id
2023-10-16 16:47:42 +08:00
where xcsp.del_flag = 0
and DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') &gt;=#{subTime}
and DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') &lt;= #{subTime}
and xcsp.status =#{number}
and xcsp.charging_pile_id =#{chargingPileId}
GROUP BY xcsp.terminal_id,DATE_FORMAT(xcsp.create_time,'%Y-%m-%d')
ORDER BY DATE_FORMAT(xcsp.create_time,'%Y-%m-%d'),xcsp.terminal_id
</select>
<select id="getSuperviseQueryAccidentInfo" parameterType="com.xhpc.evcs.cdjgpc.dto.CDSupEquipmentAccidentInfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDSupEquipmentAccidentInfo">
select
area_code as areaCode,
address as address,
accident_entitya as accidentEntity,
type as type,
accident_reason as accidentReason,
level as level,
accident_time as accidentTime,
description as description,
pictures as picturesName,
analysisReport as analysisReportName
from xhpc_equipment_accident where del_flag =0
order by create_time desc
</select>
<select id="getCDStationStatslnfoList" parameterType="com.xhpc.evcs.cdjgpc.dto.CDStationStatslnfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDStationStatslnfo">
select
xco.charging_station_id as stationID,
concat(DATE_FORMAT(xco.end_time,'%Y-%m-%d')," 00:00:00") as startTime,
concat(DATE_FORMAT(xco.end_time,'%Y-%m-%d')," 23:59:59") as endTime,
round(sum(xco.charging_degree),1) as stationElectricity,
xcs.station_classification as stationClassification,
xo.operator_id_evcs as operatorID,
xcs.equipment_owner_id as equipmentOnwerID,
round(sum(xco.charging_time_number/60),2) as stationTotalChargeTime,
count(xco.charge_order_id) as stationTotalChargeNum,
sum(xco.station_total_warning_num) as stationTotalWarningNum
from xhpc_charge_order xco
left join xhpc_charging_station xcs on xcs.charging_station_id = xco.charging_station_id
left join xhpc_operator xo on xo.operator_id = xcs.operator_id
2023-10-16 16:47:42 +08:00
where xco.end_time &gt;=#{startTime} and xco.end_time &lt;=#{endTime}
GROUP BY xco.charging_station_id
</select>
<update id="updateXhpcChargingPile">
update xhpc_charging_pile set power_number=#{powerNumber} where serial_number =#{serialNumber}
</update>
2021-12-31 10:37:40 +08:00
</mapper>