2021-07-20 10:30:25 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
2021-08-05 17:30:26 +08:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2021-07-20 10:30:25 +08:00
<mapper namespace= "com.xhpc.charging.station.mapper.XhpcChargingStationMapper" >
2021-07-28 18:07:25 +08:00
<resultMap id= "BaseResultMap" type= "com.xhpc.common.domain.XhpcChargingStation" >
<result property= "chargingStationId" column= "charging_station_id" />
<result property= "name" column= "name" />
<result property= "operatorId" column= "operator_id" />
<result property= "type" column= "type" />
<result property= "stationType" column= "station_type" />
<result property= "constructionSite" column= "construction_site" />
<result property= "serviceFacilities" column= "service_facilities" />
<result property= "peripheryFacilities" column= "periphery_facilities" />
<result property= "areaCode" column= "area_code" />
<result property= "address" column= "address" />
2021-08-05 17:30:26 +08:00
<result property= "detailedAddress" column= "detailed_address" />
<result property= "longitude" column= "longitude" />
<result property= "latitude" column= "latitude" />
<result property= "parkingInstructions" column= "parking_instructions" />
<result property= "serialNumber" column= "serial_number" />
<result property= "clientVisible" column= "client_visible" />
<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= "rateModelId" column= "rate_model_id" />
<result property= "imgId" column= "img_id" />
<result property= "businessInstructions" column= "business_instructions" />
<result property= "reminderInstructions" column= "reminder_instructions" />
2021-07-20 10:30:25 +08:00
</resultMap>
<sql id= "selectXhpcChargingStationVo" >
2021-08-05 17:30:26 +08:00
select charging_station_id,
name,
operator_id,
type,
construction_site,
service_facilities,
periphery_facilities,
area_code,
address,
detailed_address,
longitude,
latitude,
parking_instructions,
serial_number,
client_visible,
status,
del_flag,
create_time,
create_by,
update_time,
update_by,
remark,
rate_model_id
from xhpc_charging_station
2021-07-20 10:30:25 +08:00
</sql>
2021-07-29 15:28:54 +08:00
<select id= "selectXhpcChargingStationList" resultType= "java.util.Map" >
2021-07-20 10:30:25 +08:00
select
2021-08-05 17:30:26 +08:00
cs.charging_station_id as chargingStationId,
cs.name as name,
ope.name as operatorName,
cs.address as address,
(select url from xhpc_img where img_id = cs.img_id and del_flag =0 limit 1) as url,
cs.client_visible as clientVisible,
cs.status as status
2021-07-20 10:30:25 +08:00
from xhpc_charging_station as cs
left join xhpc_operator as ope on cs.operator_id = ope.operator_id
where cs.del_flag =0
2021-07-20 18:22:14 +08:00
<if test= "name !=null and name !=''" >
and cs.name like CONCAT('%',#{name},'%')
</if>
<if test= "operatorName !=null and operatorName !=''" >
and ope.name like CONCAT('%',#{operatorName},'%')
</if>
2021-07-20 10:30:25 +08:00
</select>
<select id= "selectXhpcChargingStationById" resultMap= "BaseResultMap" >
<include refid= "selectXhpcChargingStationVo" />
where charging_station_id = #{chargingStationId}
</select>
2021-07-28 18:07:25 +08:00
<insert id= "insertXhpcChargingStation" parameterType= "com.xhpc.common.domain.XhpcChargingStation" >
2021-07-20 10:30:25 +08:00
insert into xhpc_charging_station
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "chargingStationId != null" > charging_station_id,</if>
<if test= "name != null" > name,</if>
<if test= "operatorId != null" > operator_id,</if>
<if test= "type != null" > type,</if>
<if test= "constructionSite != null" > construction_site,</if>
<if test= "serviceFacilities != null" > service_facilities,</if>
<if test= "peripheryFacilities != null" > periphery_facilities,</if>
<if test= "areaCode != null" > area_code,</if>
<if test= "address != null" > address,</if>
<if test= "detailedAddress != null" > detailed_address,</if>
<if test= "longitude != null" > longitude,</if>
<if test= "latitude != null" > latitude,</if>
<if test= "parkingInstructions != null" > parking_instructions,</if>
<if test= "serialNumber != null" > serial_number,</if>
<if test= "clientVisible != null" > client_visible,</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>
2021-08-05 17:30:26 +08:00
</trim>
2021-07-20 10:30:25 +08:00
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "chargingStationId != null" > #{chargingStationId},</if>
<if test= "name != null" > #{name},</if>
<if test= "operatorId != null" > #{operatorId},</if>
<if test= "type != null" > #{type},</if>
<if test= "constructionSite != null" > #{constructionSite},</if>
<if test= "serviceFacilities != null" > #{serviceFacilities},</if>
<if test= "peripheryFacilities != null" > #{peripheryFacilities},</if>
<if test= "areaCode != null" > #{areaCode},</if>
<if test= "address != null" > #{address},</if>
<if test= "detailedAddress != null" > #{detailedAddress},</if>
<if test= "longitude != null" > #{longitude},</if>
<if test= "latitude != null" > #{latitude},</if>
<if test= "parkingInstructions != null" > #{parkingInstructions},</if>
<if test= "serialNumber != null" > #{serialNumber},</if>
<if test= "clientVisible != null" > #{clientVisible},</if>
<if test= "status != null" > #{status},</if>
<if test= "delFlag != null" > #{delFlag},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "remark != null" > #{remark},</if>
<if test= "rateModelId != null" > #{rateModelId},</if>
2021-08-05 17:30:26 +08:00
</trim>
2021-07-20 10:30:25 +08:00
</insert>
2021-07-28 18:07:25 +08:00
<update id= "updateXhpcChargingStation" parameterType= "com.xhpc.common.domain.XhpcChargingStation" >
2021-07-20 10:30:25 +08:00
update xhpc_charging_station
<trim prefix= "SET" suffixOverrides= "," >
<if test= "name != null" > name = #{name},</if>
<if test= "operatorId != null" > operator_id = #{operatorId},</if>
<if test= "type != null" > type = #{type},</if>
<if test= "constructionSite != null" > construction_site = #{constructionSite},</if>
<if test= "serviceFacilities != null" > service_facilities = #{serviceFacilities},</if>
<if test= "peripheryFacilities != null" > periphery_facilities = #{peripheryFacilities},</if>
<if test= "areaCode != null" > area_code = #{areaCode},</if>
<if test= "address != null" > address = #{address},</if>
<if test= "detailedAddress != null" > detailed_address = #{detailedAddress},</if>
<if test= "longitude != null" > longitude = #{longitude},</if>
<if test= "latitude != null" > latitude = #{latitude},</if>
<if test= "parkingInstructions != null" > parking_instructions = #{parkingInstructions},</if>
<if test= "serialNumber != null" > serial_number = #{serialNumber},</if>
<if test= "clientVisible != null" > client_visible = #{clientVisible},</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>
<if test= "remark != null" > remark = #{remark},</if>
<if test= "rateModelId != null" > rate_model_id = #{rateModelId},</if>
2021-07-27 18:09:18 +08:00
<if test= "businessInstructions != null" > business_instructions = #{businessInstructions},</if>
<if test= "reminderInstructions != null" > reminder_instructions = #{reminderInstructions},</if>
<if test= "imgId != null" > img_id = #{imgId},</if>
<if test= "stationType != null" > station_type = #{stationType},</if>
2021-07-20 10:30:25 +08:00
</trim>
where charging_station_id = #{chargingStationId}
</update>
<update id= "updateXhpcChargingStationById" parameterType= "Long" >
2021-08-05 17:30:26 +08:00
update xhpc_charging_station
set del_flag =1
where charging_station_id = #{chargingStationId}
2021-07-20 10:30:25 +08:00
</update>
2021-07-29 17:39:20 +08:00
<update id= "updateXhpcChargingStationByIds" parameterType= "java.lang.String" >
2021-08-05 17:30:26 +08:00
update xhpc_charging_station set del_flag =1 where charging_station_id in
2021-07-20 10:30:25 +08:00
<foreach item= "chargingStationId" collection= "array" open= "(" separator= "," close= ")" >
#{chargingStationId}
</foreach>
</update>
2021-07-20 20:03:06 +08:00
<update id= "status" >
2021-08-05 17:30:26 +08:00
update xhpc_charging_station
set status =#{status}
where charging_station_id = #{chargingStationId}
and del_flag = 0
2021-07-20 20:03:06 +08:00
</update>
<update id= "clientVisible" >
2021-08-05 17:30:26 +08:00
update xhpc_charging_station
set client_visible =#{clientVisible}
where charging_station_id = #{chargingStationId}
and del_flag = 0
2021-07-20 20:03:06 +08:00
</update>
2021-07-29 15:28:54 +08:00
<select id= "stationInternetBlackList" resultType= "java.util.Map" >
2021-08-05 17:30:26 +08:00
select name
from xhpc_internet_user
where del_flag = 0
and internet_user_id not in (select internet_user_id
from xhpc_station_internet_blacklist
where charging_station_id = #{chargingStationId})
2021-07-20 20:03:06 +08:00
</select>
2021-07-21 16:00:52 +08:00
2021-07-29 15:28:54 +08:00
<select id= "getXhpcChargingStationMessage" resultType= "java.util.Map" >
2021-08-13 19:12:07 +08:00
select ct.charging_station_id as chargingStationId,
ct.name as name,
ct.operator_id as operatorId,
ct.station_type as stationType,
op.name as operatorName,
ct.type as type,
2021-08-05 17:30:26 +08:00
(select dict_value
from xhpc_dict_biz
2021-08-13 19:12:07 +08:00
where code = 'charging_station_type'
and dict_key = ct.station_type) as stationTypeName,
ct.serial_number as serialNumber,
ct.construction_site as constructionSite,
2021-08-05 17:30:26 +08:00
(select dict_value
from xhpc_dict_biz
2021-08-13 19:12:07 +08:00
where code = 'charging_construction_site'
and dict_key = ct.construction_site) as constructionSiteName,
ct.address as address,
ct.remark as remark,
ct.detailed_address as detailedAddress,
ct.periphery_facilities as peripheryFacilities,
ct.service_facilities as serviceFacilities,
ct.parking_instructions as parkingInstructions,
ct.business_instructions as businessInstructions,
ct.reminder_instructions as reminderInstructions,
ct.client_visible as clientVisible,
ct.img_id as imgId,
GROUP_CONCAT(DISTINCT xdbs.dict_value ORDER BY xdbs.create_time ASC separator ',' ) serviceFacilitiesName,
GROUP_CONCAT(DISTINCT xdbp.dict_value ORDER BY xdbp.create_time ASC separator ',' ) peripheryFacilitiesName
2021-07-26 19:41:45 +08:00
from xhpc_charging_station as ct
2021-08-05 17:30:26 +08:00
left join xhpc_operator as op on op.operator_id = ct.operator_id
where ct.charging_station_id = #{chargingStationId}
and ct.del_flag = 0
2021-07-26 19:41:45 +08:00
</select>
<select id= "getWXList" resultType= "map" >
2021-07-21 16:00:52 +08:00
select
2021-08-13 19:12:07 +08:00
cs.charging_station_id as chargingStationId,
cs.name as name,
cs.parking_instructions as parkingInstructions,
cs.detailed_address as detailedAddress,
cs.service_facilities as serviceFacilities,
(select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and
charging_station_id=cs.charging_station_id) as common,
(select (ra.power_fee+ra.service_fee) as serviceFee
from xhpc_rate as ra
where ra.status = 0
and ra.del_flag = 0
and ra.rate_id = (
select rate_id from xhpc_rate_time
where charging_station_id = cs.charging_station_id
and start_time < = #{date}
and end_time > = #{date}
and status = 0
and del_flag = 0)) money,
(select GROUP_CONCAT(dict_value) from xhpc_dict_biz where FIND_IN_SET(dict_key,cs.service_facilities ) and code
= 'service_facilities' and parent_id > 0 and del_flag = 0) as serviceFacilitiesName,
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180 ) *SIN((cs.latitude * 3.141593) / 180 ) +
COS((#{latitude} * 3.141593) / 180 ) * COS((cs.latitude * 3.141593) / 180 ) *
COS((#{longitude} * 3.141593) / 180 - (cs.longitude * 3.141593) / 180 ) ) * 6370.9968,4)AS distance
from xhpc_charging_station as cs
where cs.del_flag =0 and cs.status =0
and FIND_IN_SET(#{clientVisible},cs.client_visible)>0
2021-07-21 16:00:52 +08:00
<if test= "name !=null and name !=''" >
2021-08-13 19:12:07 +08:00
and cs.name like CONCAT('%',#{name},'%')
2021-07-21 16:00:52 +08:00
</if>
<if test= "serviceFacilities !=null and serviceFacilities.size()>0 " >
2021-07-21 17:44:43 +08:00
and
<foreach collection= "serviceFacilities" item= "item" index= "index" open= "(" close= ")" separator= "or" >
2021-08-13 19:12:07 +08:00
cs.service_facilities like CONCAT('%',#{item},'%')
2021-07-21 16:00:52 +08:00
</foreach>
</if>
<if test= "code !=null and code !=''" >
2021-08-13 19:12:07 +08:00
and (cs.area_code in (select
cscode
2021-07-29 15:07:34 +08:00
from xhpc_area where pcode=#{code}) or area_code=#{code})
2021-07-21 16:00:52 +08:00
</if>
ORDER BY distance asc
</select>
2021-07-29 15:28:54 +08:00
<select id= "getCode" resultType= "java.util.Map" >
2021-07-21 16:00:52 +08:00
select code, dict_key, dict_value
from xhpc_dict_biz
where code = #{code} and parent_id > 0 and del_flag = 0
<if test= "serviceFacilities !=null and serviceFacilities.size()>0 " >
2021-08-05 17:30:26 +08:00
and
<foreach collection= "serviceFacilities" item= "item" index= "index" open= "(" close= ")" separator= "or" >
dict_biz_id like CONCAT('%',#{item},'%')
</foreach>
2021-07-21 16:00:52 +08:00
</if>
</select>
2021-07-22 13:52:21 +08:00
2021-07-29 15:28:54 +08:00
<select id= "getWXXhpcChargingStationMessage" resultType= "java.util.Map" >
2021-08-13 19:12:07 +08:00
select charging_station_id as chargingStationId,
2021-08-05 17:30:26 +08:00
(select type
from xhpc_charging_pile
2021-08-13 19:12:07 +08:00
where charging_station_id = charging_station_id
and del_flag = 0
and status = 0 limit 1) as type,
(select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and charging_station_id=charging_station_id) as common,
(select GROUP_CONCAT(dict_value) from xhpc_dict_biz where FIND_IN_SET(dict_key,service_facilities ) and code= 'service_facilities' and parent_id > 0 and del_flag = 0) as serviceFacilitiesName,
2021-08-05 17:30:26 +08:00
name as name,
reminder_instructions as reminderInstructions,
detailed_address as detailedAddress,
parking_instructions as parkingInstructions,
business_instructions as businessInstructions,
service_facilities as serviceFacilities,
img_id as imgId,
remark as remark,
2021-08-13 19:12:07 +08:00
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180) * SIN((latitude * 3.141593) / 180) + COS((#{latitude} * 3.141593) / 180) * COS((latitude * 3.141593) / 180) * COS((#{longitude} * 3.141593) / 180 - (longitude * 3.141593) / 180)) * 6370.9968,
4) AS distance
2021-07-22 13:52:21 +08:00
from xhpc_charging_station
2021-07-28 10:28:02 +08:00
2021-08-05 17:30:26 +08:00
where charging_station_id = #{chargingStationId}
and del_flag = 0
and status = 0
2021-07-22 13:52:21 +08:00
</select>
2021-07-29 15:28:54 +08:00
<select id= "getImageList" resultType= "java.util.Map" >
2021-07-22 13:52:21 +08:00
select
2021-08-05 17:30:26 +08:00
img_id as imgId,
url as url
2021-07-22 13:52:21 +08:00
from xhpc_img where del_flag=0 and status=0
<if test= "imgIds !=null and imgIds.size()>0 " >
2021-07-27 18:09:18 +08:00
and img_id in
2021-08-05 17:30:26 +08:00
<foreach collection= "imgIds" item= "chargingStationId" open= "(" separator= "," close= ")" >
2021-07-22 13:52:21 +08:00
#{chargingStationId}
</foreach>
</if>
</select>
2021-07-22 20:08:33 +08:00
2021-07-29 15:28:54 +08:00
<select id= "getWXXhpcRateTimeMassage" resultType= "java.util.Map" >
2021-08-05 17:30:26 +08:00
select xrt.start_time as startTime,
xrt.end_time as endTime,
xr.power_fee as powerFee,
xr.service_fee as serviceFee
2021-07-22 20:08:33 +08:00
from xhpc_rate_time as xrt
2021-08-05 17:30:26 +08:00
left join xhpc_rate as xr on xr.rate_id = xrt.rate_id
where xrt.charging_station_id = #{chargingStationId}
and xrt.status = 0
and xrt.del_flag = 0
2021-07-22 20:08:33 +08:00
order by xrt.sort asc
</select>
2021-07-29 15:28:54 +08:00
<select id= "getWXXhpcTerminalMassage" resultType= "java.util.Map" >
2021-08-05 17:30:26 +08:00
select te.name as name,
cp.power as power,
cp.auxiliary_power_supply as auxiliaryPowerSupply,
2021-08-11 16:25:10 +08:00
te.serial_number as serialNumber,
2021-08-05 17:30:26 +08:00
cp.input_voltage as inputVoltage
2021-07-22 20:08:33 +08:00
from xhpc_terminal as te
2021-08-05 17:30:26 +08:00
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
where te.charging_station_id = #{chargingStationId}
and te.status = 0
and te.del_flag = 0
2021-07-22 20:08:33 +08:00
</select>
2021-07-24 19:05:48 +08:00
2021-07-28 18:07:25 +08:00
<insert id= "addXhpcRateModel" parameterType= "com.xhpc.common.domain.XhpcRateModel" useGeneratedKeys= "true"
keyProperty="rateModelId">
2021-07-24 19:05:48 +08:00
insert into xhpc_rate_model
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<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>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<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>
</trim>
</insert>
2021-07-28 18:07:25 +08:00
<insert id= "addXhpcChargingStation" parameterType= "com.xhpc.common.domain.XhpcChargingStation"
useGeneratedKeys="true" keyProperty="chargingStationId">
2021-07-24 19:05:48 +08:00
insert into xhpc_charging_station
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "null != name and '' != name" >
name,
</if>
<if test= "null != operatorId " >
operator_id,
</if>
<if test= "null != type " >
type,
</if>
<if test= "null != constructionSite and '' != constructionSite" >
construction_site,
</if>
<if test= "null != serviceFacilities and '' != serviceFacilities" >
service_facilities,
</if>
<if test= "null != peripheryFacilities and '' != peripheryFacilities" >
periphery_facilities,
</if>
<if test= "null != areaCode " >
area_code,
</if>
<if test= "null != address and '' != address" >
address,
</if>
<if test= "null != detailedAddress and '' != detailedAddress" >
detailed_address,
</if>
<if test= "null != longitude and '' != longitude" >
longitude,
</if>
<if test= "null != latitude and '' != latitude" >
latitude,
</if>
<if test= "null != parkingInstructions and '' != parkingInstructions" >
parking_instructions,
</if>
<if test= "null != serialNumber and '' != serialNumber" >
serial_number,
</if>
<if test= "null != clientVisible and '' != clientVisible" >
client_visible,
</if>
<if test= "null != rateModelId and '' != rateModelId" >
rate_model_id,
</if>
<if test= "null != imgId and '' != imgId" >
img_id,
</if>
2021-07-27 18:09:18 +08:00
<if test= "null != businessInstructions and '' != businessInstructions" >
2021-07-24 19:05:48 +08:00
business_instructions,
</if>
<if test= "null != reminderInstructions and '' != reminderInstructions" >
reminder_instructions,
</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" >
2021-08-05 16:17:04 +08:00
remark,
</if>
<if test= "null != stationType" >
station_type
2021-07-24 19:05:48 +08:00
</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "null != name and '' != name" >
2021-08-05 17:30:26 +08:00
#{name},
2021-07-24 19:05:48 +08:00
</if>
<if test= "null != operatorId " >
#{operatorId},
</if>
<if test= "null != type " >
#{type},
</if>
<if test= "null != constructionSite and '' != constructionSite" >
#{constructionSite},
</if>
<if test= "null != serviceFacilities and '' != serviceFacilities" >
#{serviceFacilities},
</if>
<if test= "null != peripheryFacilities and '' != peripheryFacilities" >
#{peripheryFacilities},
</if>
<if test= "null != areaCode " >
#{areaCode},
</if>
<if test= "null != address and '' != address" >
#{address},
</if>
<if test= "null != detailedAddress and '' != detailedAddress" >
#{detailedAddress},
</if>
<if test= "null != longitude and '' != longitude" >
#{longitude},
</if>
<if test= "null != latitude and '' != latitude" >
#{latitude},
</if>
<if test= "null != parkingInstructions and '' != parkingInstructions" >
#{parkingInstructions},
</if>
<if test= "null != serialNumber and '' != serialNumber" >
#{serialNumber},
</if>
<if test= "null != clientVisible and '' != clientVisible" >
#{clientVisible},
</if>
<if test= "null != rateModelId and '' != rateModelId" >
#{rateModelId},
</if>
<if test= "null != imgId and '' != imgId" >
#{imgId},
</if>
2021-07-27 18:09:18 +08:00
<if test= "null != businessInstructions and '' != businessInstructions" >
#{businessInstructions},
2021-07-24 19:05:48 +08:00
</if>
<if test= "null != reminderInstructions and '' != reminderInstructions" >
#{reminderInstructions},
</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" >
2021-08-05 16:17:04 +08:00
#{remark},
</if>
<if test= "null != stationType" >
#{stationType}
2021-07-24 19:05:48 +08:00
</if>
</trim>
</insert>
2021-07-28 18:07:25 +08:00
<insert id= "addXhpcRate" parameterType= "com.xhpc.common.domain.XhpcRate" useGeneratedKeys= "true"
keyProperty="rateId">
2021-07-24 19:05:48 +08:00
insert into xhpc_rate
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "null != chargingStationId " >
charging_station_id,
</if>
<if test= "null != powerFee " >
power_fee,
</if>
<if test= "null != serviceFee " >
service_fee,
</if>
<if test= "null != name and '' != name" >
name,
</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" >
2021-08-04 17:12:59 +08:00
remark,
</if>
<if test= "null != rateValue" >
rate_value
2021-07-24 19:05:48 +08:00
</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "null != chargingStationId " >
#{chargingStationId},
</if>
<if test= "null != powerFee " >
#{powerFee},
</if>
<if test= "null != serviceFee " >
#{serviceFee},
</if>
<if test= "null != name and '' != name" >
#{name},
</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" >
2021-08-04 17:12:59 +08:00
#{remark},
</if>
<if test= "null != rateValue" >
#{rateValue}
2021-07-24 19:05:48 +08:00
</if>
</trim>
</insert>
2021-07-28 18:07:25 +08:00
<insert id= "addXhpcRateTime" parameterType= "com.xhpc.common.domain.XhpcRateTime" useGeneratedKeys= "true"
keyProperty="rateId">
2021-07-24 19:05:48 +08:00
insert into xhpc_rate_time
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "null != chargingStationId " >
charging_station_id,
</if>
<if test= "null != rateId " >
rate_id,
</if>
<if test= "null != startTime " >
start_time,
</if>
<if test= "null != endTime " >
end_time,
</if>
<if test= "null != rateModelId " >
rate_model_id,
</if>
<if test= "null != sort " >
sort,
</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" >
2021-08-04 17:12:59 +08:00
remark,
2021-07-24 19:05:48 +08:00
</if>
2021-07-26 19:41:45 +08:00
<if test= "null != type " >
2021-08-04 17:12:59 +08:00
type,
</if>
<if test= "null != rateValue " >
rate_value
2021-07-26 19:41:45 +08:00
</if>
2021-07-24 19:05:48 +08:00
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "null != chargingStationId " >
#{chargingStationId},
</if>
<if test= "null != rateId " >
#{rateId},
</if>
<if test= "null != startTime " >
#{startTime},
</if>
<if test= "null != endTime " >
#{endTime},
</if>
<if test= "null != rateModelId " >
#{rateModelId},
</if>
<if test= "null != sort " >
sort,
</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" >
2021-08-04 17:12:59 +08:00
#{remark},
2021-07-24 19:05:48 +08:00
</if>
2021-07-26 19:41:45 +08:00
<if test= "null != type " >
2021-08-04 17:12:59 +08:00
#{type},
</if>
<if test= "null != rateValue " >
#{rateValue}
2021-07-26 19:41:45 +08:00
</if>
2021-07-24 19:05:48 +08:00
</trim>
</insert>
2021-07-29 15:28:54 +08:00
<select id= "getXhpcRateList" resultType= "java.util.Map" >
2021-08-05 17:30:26 +08:00
select power_fee as powerFee,
service_fee as serviceFee,
name as name,
rate_value as id
2021-07-26 19:41:45 +08:00
from xhpc_rate
2021-08-05 17:30:26 +08:00
where charging_station_id = #{chargingStationId}
and del_flag = 0
2021-07-30 16:29:52 +08:00
GROUP BY rate_value
2021-07-26 19:41:45 +08:00
</select>
2021-07-24 19:05:48 +08:00
2021-07-29 15:28:54 +08:00
<select id= "getXhpcRateTimeTypeList" resultType= "java.util.Map" >
2021-08-05 20:30:16 +08:00
select rt.start_time as startTime,
replace(rt.end_time, '00:00:00', '24:00:00') AS endTime,
rt.rate_id as rateId,
rt.rate_value as id,
ra.name as rateName,
ra.power_fee as powerFee,
ra.service_fee as serviceFee
from xhpc_rate_time as rt
left join xhpc_rate as ra on ra.rate_id = rt.rate_id
where rt.charging_station_id = #{chargingStationId}
and rt.del_flag = 0
2021-07-26 19:41:45 +08:00
</select>
2021-07-29 15:28:54 +08:00
<select id= "getXhpcRateTimeOrderStatistics" resultType= "java.util.Map" >
2021-08-05 17:30:26 +08:00
select IF(SUM(charging_degree) IS NULL, 0, charging_degree) as chargingDegreeSum,
COUNT(real_time_order_id) as realTimeOrderIdCount,
COUNT(DISTINCT user_id) as userIdCount
2021-07-26 19:41:45 +08:00
from xhpc_real_time_order
where real_time_order_id in (
2021-08-05 17:30:26 +08:00
select max(real_time_order_id)
from xhpc_real_time_order
WHERE to_days(create_time) = to_days(now())
and charging_station_id = #{chargingStationId}
group by charging_order_id)
2021-07-26 19:41:45 +08:00
</select>
2021-07-27 18:09:18 +08:00
<update id= "updateXhpcRate" >
2021-08-05 17:30:26 +08:00
update xhpc_rate
set del_flag =1
where charging_station_id = #{chargingStationId}
and del_flag = 0
2021-07-27 18:09:18 +08:00
</update>
<update id= "updateXhpcRateTime" >
2021-08-05 17:30:26 +08:00
update xhpc_rate_time
set del_flag =1
where charging_station_id = #{chargingStationId}
and del_flag = 0
2021-07-27 18:09:18 +08:00
</update>
2021-07-29 16:45:43 +08:00
2021-07-29 17:39:20 +08:00
<select id= "getXchargingPileList" resultType= "java.lang.String" >
2021-08-05 17:30:26 +08:00
select serial_number as pileNo
2021-07-29 16:45:43 +08:00
from xhpc_charging_pile
2021-08-05 17:30:26 +08:00
where charging_station_id = #{chargingStationId}
and del_flag = 0
and status = 0
2021-07-29 16:45:43 +08:00
</select>
2021-07-30 16:29:52 +08:00
<select id= "getXhpcRateTimeNumber" resultType= "java.util.Map" >
2021-08-05 17:30:26 +08:00
SELECT CAST(((UNIX_TIMESTAMP(end_time) - UNIX_TIMESTAMP(start_time)) / 1800) AS SIGNED) as number,
rate_value as rateValue
FROM xhpc_rate_time
where charging_station_id = #{chargingStationId}
2021-07-30 16:29:52 +08:00
order by sort
</select>
2021-07-28 18:07:25 +08:00
</mapper>