361 lines
14 KiB
XML
Raw Normal View History

2021-07-27 18:09:18 +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">
2021-07-27 18:09:18 +08:00
<mapper namespace="com.xhpc.charging.station.mapper.XhpcChargingPileMapper">
2021-07-28 18:07:25 +08:00
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcChargingPile">
<result property="chargingPileId" 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="minElectriCurrent" 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"/>
2021-07-27 18:09:18 +08:00
</resultMap>
2021-07-27 18:29:50 +08:00
<sql id="selectXhpcChargingPileVo">
select charging_pile_id,
charging_station_id,
name,
national_standard,
power,
auxiliary_power_supply,
input_voltage,
max_voltage,
min_voltage,
max_electric_current,
min_electric_current,
serial_number,
type,
program_version,
network_link_type,
gun_number,
communication_protocol_version,
communication_operator,
sim_card,
rate_model_id,
status,
del_flag,
create_time,
create_by,
update_time,
update_by,
remark,
rate_model_id,
brand_model
from xhpc_charging_pile
2021-07-27 18:29:50 +08:00
</sql>
2021-07-29 15:28:54 +08:00
<select id="selectXhpcChargingPileList" resultType="java.util.Map">
2021-07-27 18:09:18 +08:00
select
cp.charging_pile_id as chargingPileId,
cp.charging_station_id as chargingStationId,
cp.name as chargingPileName,
st.name as chargingStationName,
cp.serial_number as serialNumber,
cp.brand_model as brandModel,
cp.type as type,
cp.power as power,
cp.gun_number as gunNumber,
cp.status as status
from xhpc_charging_pile as cp
2021-07-27 18:09:18 +08:00
left join xhpc_charging_station as st on st.charging_station_id =cp.charging_station_id
where cp.del_flag =0
<if test="name !=null and name !=''">
and cp.name like CONCAT('%',#{name},'%')
</if>
<if test="type !=null and type !=''">
and cp.type=#{type}
</if>
<if test="serialNumber !=null and serialNumber!=''">
and cp.serial_number=#{serialNumber}
</if>
<if test="chargingStationId !=null and chargingStationId!=''">
and cp.charging_station_id=#{chargingStationId}
</if>
order by cp.create_time desc
</select>
2021-07-28 18:07:25 +08:00
<insert id="addXhpcChargingPile" parameterType="com.xhpc.common.domain.XhpcChargingPile" useGeneratedKeys="true"
keyProperty="chargingPileId">
2021-07-27 18:09:18 +08:00
insert into xhpc_charging_pile
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != name ">
name,
</if>
<if test="null != nationalStandard ">
national_standard,
</if>
<if test="null != power ">
power,
</if>
<if test="null != auxiliaryPowerSupply ">
auxiliary_power_supply,
</if>
<if test="null != inputVoltage ">
input_voltage,
</if>
<if test="null != maxVoltage ">
max_voltage,
</if>
<if test="null != minVoltage ">
min_voltage,
</if>
<if test="null != maxElectricCurrent ">
max_electric_current,
</if>
<if test="null != minElectriCurrent ">
min_electric_current,
</if>
<if test="null != serialNumber ">
serial_number,
</if>
<if test="null != type ">
type,
</if>
<if test="null != programVersion ">
program_version,
</if>
<if test="null != networkLinkType ">
network_link_type,
</if>
<if test="null != gunNumber ">
gun_number,
</if>
<if test="null != communicationProtocolVersion ">
communication_protocol_version,
</if>
<if test="null != communicationOperator ">
communication_operator,
</if>
<if test="null != simCard ">
sim_card,
</if>
<if test="null != rateModelId ">
rate_model_id,
</if>
<if test="null != status ">
status,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark
</if>
<if test="null != brandModel ">
brand_model
</if>
2021-07-27 18:09:18 +08:00
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != name ">
#{name},
</if>
<if test="null != nationalStandard ">
#{nationalStandard},
</if>
<if test="null != power ">
#{power},
</if>
<if test="null != auxiliaryPowerSupply ">
#{auxiliaryPowerSupply},
</if>
<if test="null != inputVoltage ">
#{inputVoltage},
</if>
<if test="null != maxVoltage ">
#{maxVoltage},
</if>
<if test="null != minVoltage ">
#{minVoltage},
</if>
<if test="null != maxElectricCurrent ">
#{maxElectricCurrent},
</if>
<if test="null != minElectriCurrent ">
#{minElectriCurrent},
</if>
<if test="null != serialNumber ">
#{serialNumber},
</if>
<if test="null != type ">
#{type},
</if>
<if test="null != programVersion ">
#{programVersion},
</if>
<if test="null != networkLinkType ">
#{networkLinkType},
</if>
<if test="null != gunNumber ">
#{gunNumber},
</if>
<if test="null != communicationProtocolVersion ">
#{communicationProtocolVersion},
</if>
<if test="null != communicationOperator ">
#{communicationOperator},
</if>
<if test="null != simCard ">
#{simCard},
</if>
<if test="null != rateModelId ">
#{rateModelId},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
<if test="null != brandModel ">
#{brandModel}
</if>
2021-07-27 18:09:18 +08:00
</trim>
</insert>
2021-07-29 15:28:54 +08:00
<select id="selectXhpcChargingStationById" resultType="java.util.Map">
select charging_station_id as chargingStationId,
rate_model_id as rateModelId
from xhpc_charging_station
where charging_station_id = #{chargingStationId}
2021-07-27 18:09:18 +08:00
</select>
2021-07-27 18:29:50 +08:00
<select id="selectXhpcChargingPileById" resultMap="BaseResultMap">
<include refid="selectXhpcChargingPileVo"/>
where charging_pile_id = #{chargingPileId}
</select>
2021-07-28 10:28:02 +08:00
<update id="updaeXhpcChargingPile" parameterType="Integer">
2021-07-28 17:28:19 +08:00
update xhpc_charging_pile
<trim prefix="SET" suffixOverrides=",">
<if test="chargingStationId != null">charging_station_id = #{chargingStationId},</if>
<if test="name != null">name = #{name},</if>
<if test="nationalStandard != null">national_standard = #{nationalStandard},</if>
<if test="power != null">power = #{power},</if>
<if test="auxiliaryPowerSupply != null">auxiliary_power_supply = #{auxiliaryPowerSupply},</if>
<if test="inputVoltage != null">input_voltage = #{inputVoltage},</if>
<if test="maxVoltage != null">max_voltage = #{maxVoltage},</if>
<if test="minVoltage != null">min_voltage = #{minVoltage},</if>
<if test="maxElectricCurrent != null">max_electric_current = #{maxElectricCurrent},</if>
<if test="minElectriCurrent != null">min_electric_current = #{minElectriCurrent},</if>
<if test="serialNumber != null">serial_number = #{serialNumber},</if>
<if test="type != null">type = #{type},</if>
<if test="programVersion != null">program_version = #{programVersion},</if>
<if test="networkLinkType != null">network_link_type = #{networkLinkType},</if>
2021-08-05 17:40:57 +08:00
<if test="gunNumber != null">gun_number = #{gunNumber},</if>
<if test="networkLinkType != null">network_link_type = #{networkLinkType},</if>
<if test="communicationProtocolVersion != null">communication_protocol_version =
#{communicationProtocolVersion},
</if>
2021-07-28 17:28:19 +08:00
<if test="communicationOperator != null">communication_operator = #{communicationOperator},</if>
<if test="simCard != null">sim_card = #{simCard},</if>
<if test="rateModelId != null">rate_model_id = #{rateModelId},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
2021-07-28 20:15:54 +08:00
<if test="remark != null">remark = #{remark}</if>
<if test="brandModel != null">brand_model = #{brandModel}</if>
2021-07-28 17:28:19 +08:00
</trim>
where charging_pile_id = #{chargingPileId}
2021-07-28 10:28:02 +08:00
</update>
2021-07-28 17:28:19 +08:00
2021-07-29 15:28:54 +08:00
<select id="selectXhpcTerminalList" resultType="java.util.Map">
2021-07-28 17:28:19 +08:00
select
te.terminal_id as terminalId,
te.name as terminalName,
ct.name as chargingStationName,
te.pile_serial_number as pileSerialNumber,
cp.power as power,
cp.serial_number as serialNumber,
2021-07-29 15:28:54 +08:00
cp.max_voltage as maxVoltage,
2021-07-28 17:28:19 +08:00
te.status as status,
te.work_status as workStatus
from xhpc_terminal as te
left join xhpc_charging_station as ct on ct.charging_station_id = te.charging_station_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
where te.del_flag=0
<if test="chargingPileId !=null">
and te.charging_pile_id=#{chargingPileId}
2021-07-28 17:28:19 +08:00
</if>
</select>
<update id="updateXhpcChargingPileById">
update xhpc_charging_pile
set del_flag =1
where charging_pile_id = #{chargingPileId}
</update>
2021-08-04 18:23:48 +08:00
<select id="getXhpcChargingPileSerialNumberCount" resultType="int">
select count(charging_pile_id)
from xhpc_charging_pile
where serial_number = #{serialNumber}
2021-08-04 18:23:48 +08:00
</select>
2021-08-05 16:17:04 +08:00
<update id="updateXhpcTerminal">
update xhpc_terminal
set del_flag = 2
where charging_pile_id = #{chargingPileId}
2021-08-05 16:17:04 +08:00
</update>
<select id="countXhpcTerminal" resultType="int">
select count(id) from xhpc_charging_pile where charging_station_id = #{chargingStationId}
</select>
2021-07-28 18:07:25 +08:00
</mapper>