334 lines
12 KiB
XML
Raw Normal View History

<?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.xhpc.charging.station.mapper.XhpcTimingChargingModelMapper">
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTimingChargingModel">
<result property="timingChargingModelId" column="timing_charging_model_id"/>
<result property="reason" column="reason"/>
<result property="chargingStationId" column="charging_station_id"/>
<result property="timingTime" column="timing_time"/>
<result property="errorReason" column="error_reason"/>
<result property="number" column="number"/>
<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="tenantId" column="tenant_id"/>
</resultMap>
<select id="list" resultType="map">
select
tcm.timing_charging_model_id as timingChargingModelId,
tcm.reason as reason,
cs.name as chargingStationName,
tcm.timing_time as timingTime,
tcm.status as status,
tcm.create_time as createTime
from xhpc_timing_charging_model as tcm
left join xhpc_charging_station as cs on cs.charging_station_id = tcm.charging_station_id
where tcm.del_flag =0
<if test="chargingStationId !=null">
and tcm.charging_station_id = #{chargingStationId}
</if>
<if test="reason !=null and ''!=reason">
and tcm.reason like concat('%', #{reason}, '%')
</if>
<if test="status !=null">
and tcm.status = #{status}
</if>
<if test="startTime !=null and '' !=startTime">
and tcm.timing_time &gt;=#{startTime}
</if>
<if test="endTime !=null and '' !=endTime">
and tcm.timing_time &lt;=#{endTime}
</if>
</select>
<insert id="insertXhpcTimingChargingModel" parameterType="com.xhpc.common.domain.XhpcTimingChargingModel" useGeneratedKeys="true" keyProperty="timingChargingModelId">
insert into xhpc_timing_charging_model
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != reason and ''!=reason">
reason,
</if>
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != timingTime ">
timing_time,
</if>
<if test="null != tenantId ">
tenant_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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != reason and ''!=reason">
#{reason},
</if>
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != timingTime ">
#{timingTime},
</if>
<if test="null != tenantId ">
#{tenantId},
</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>
</trim>
</insert>
<insert id="insertXhpcTtimingChargingRate" parameterType="com.xhpc.common.domain.XhpcTtimingChargingRate" useGeneratedKeys="true" keyProperty="timingChargingRateId">
insert into xhpc_timing_charging_rate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != powerFee">
power_fee,
</if>
<if test="null != serviceFee">
service_fee,
</if>
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != name and ''!=name">
name,
</if>
<if test="null != timingChargingModelId ">
timing_charging_model_id,
</if>
<if test="null != rateValue and ''!=rateValue ">
rate_value,
</if>
<if test="null != tenantId ">
tenant_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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != powerFee">
#{powerFee},
</if>
<if test="null != serviceFee">
#{serviceFee},
</if>
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != name and ''!=name">
#{name},
</if>
<if test="null != timingChargingModelId ">
#{timingChargingModelId},
</if>
<if test="null != rateValue and ''!=rateValue ">
#{rateValue},
</if>
<if test="null != tenantId ">
#{tenantId},
</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>
</trim>
</insert>
<insert id="insertXhpcTimingChargingTime" parameterType="com.xhpc.common.domain.XhpcTimingChargingTime" useGeneratedKeys="true" keyProperty="timingChargingTimeId">
insert into xhpc_timing_charging_time
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != timingChargingRateId">
timing_charging_rate_id,
</if>
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != startTime">
start_time,
</if>
<if test="null != endTime">
end_time,
</if>
<if test="null != timingChargingModelId ">
timing_charging_model_id,
</if>
<if test="null != rateValue and ''!=rateValue ">
rate_value,
</if>
<if test="null != type ">
type,
</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != timingChargingRateId">
#{timingChargingRateId},
</if>
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != startTime">
#{startTime},
</if>
<if test="null != endTime">
#{endTime},
</if>
<if test="null != timingChargingModelId ">
#{timingChargingModelId},
</if>
<if test="null != rateValue and ''!=rateValue ">
#{rateValue},
</if>
<if test="null != type ">
#{type},
</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>
</trim>
</insert>
<select id="getXhpcTimingChargingModelById" resultMap="BaseResultMap">
select * from xhpc_timing_charging_model where timing_charging_model_id =#{timingChargingModelId} and del_flag=0
</select>
<update id="updateXhpcTimingChargingModel" parameterType="Integer">
update xhpc_timing_charging_model
<trim prefix="SET" suffixOverrides=",">
<if test="chargingStationId != null">charging_station_id = #{chargingStationId},</if>
<if test="reason != null and ''!=reason">reason = #{reason},</if>
<if test="timingTime != null">timing_time = #{timingTime},</if>
<if test="errorReason != null and ''!=errorReason">error_reason = #{errorReason},</if>
<if test="number != null">number = #{number},</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>
</trim>
where timing_charging_model_id =#{timingChargingModelId}
</update>
</mapper>