349 lines
13 KiB
XML
349 lines
13 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">
|
|
<mapper namespace="com.xhpc.charging.station.mapper.XhpcPlaceholderMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcPlaceholder">
|
|
<result property="placeholderId" column="placeholder_id"/>
|
|
<result property="chargingStationId" column="charging_station_id"/>
|
|
<result property="startTime" column="start_time"/>
|
|
<result property="endTime" column="end_time"/>
|
|
<result property="status" column="status"/>
|
|
<result property="content" column="content"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
<result property="maxFee" column="max_fee"/>
|
|
<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"/>
|
|
<result property="type" column="type"/>
|
|
<result property="ykcStatus" column="ykc_status"/>
|
|
</resultMap>
|
|
|
|
<select id="getXhpcPlaceholderList" resultType="map">
|
|
select
|
|
xp.placeholder_id as placeholderId,
|
|
xp.start_time as startTime,
|
|
xp.end_time as endTime,
|
|
xp.status as status,
|
|
xp.type as type,
|
|
xp.ykc_status as ykcStatus,
|
|
xp.free_time as freeTime,
|
|
xp.max_fee as maxFee,
|
|
xp.create_time createTime,
|
|
xcs.name as chargingStationName,
|
|
xp.user_type as userType,
|
|
xp.charging_station_id as chargingStationId,
|
|
(select group_concat(inu.name separator ',')
|
|
from xhpc_internet_user inu
|
|
where find_in_set(inu.internet_user_id, xp.internet_user_id) > 0
|
|
) as internetUserNames
|
|
from xhpc_placeholder xp
|
|
left join xhpc_charging_station xcs on xcs.charging_station_id = xp.charging_station_id
|
|
where xp.del_flag=0
|
|
<if test="params.tenantId!= null and params.tenantId!=''">
|
|
and xp.tenant_id=#{params.tenantId}
|
|
</if>
|
|
<if test="params.chargingStationId!= null and params.chargingStationId!=''">
|
|
and xp.charging_station_id=#{params.chargingStationId}
|
|
</if>
|
|
<if test="params.status!= null and params.status!=''">
|
|
and xp.status=#{params.status}
|
|
</if>
|
|
<if test="params.chargingStationId!= null and params.chargingStationId!=''">
|
|
and xp.charging_station_id=#{params.chargingStationId}
|
|
</if>
|
|
|
|
<if test="params.startTime!= null and params.startTime!=''">
|
|
and xp.start_time >=#{params.startTime}
|
|
</if>
|
|
|
|
<if test="params.endTime!= null and params.endTime!=''">
|
|
and xp.end_time <=#{params.endTime}
|
|
</if>
|
|
<if test="params.status!= null and params.status!=''">
|
|
and xp.status=#{params.status}
|
|
</if>
|
|
<if test="params.type!= null and params.type!=''">
|
|
and xp.type=#{params.type}
|
|
</if>
|
|
<if test="params.ykcStatus!= null and params.ykcStatus!=''">
|
|
and xp.ykc_status=#{params.ykcStatus}
|
|
</if>
|
|
<if test="params.type ==1">
|
|
and xp.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.logOperatorId})
|
|
</if>
|
|
<if test="params.type ==2">
|
|
and xp.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.logOperatorId})
|
|
</if>
|
|
order by xp.create_time desc
|
|
</select>
|
|
|
|
<select id="getXhpcPlaceholderDetail" resultType="map">
|
|
select
|
|
xp.placeholder_id as placeholderId,
|
|
xp.start_time as startTime,
|
|
xp.end_time as endTime,
|
|
xp.status as status,
|
|
xp.type as type,
|
|
xp.ykc_status as ykcStatus,
|
|
xp.free_time as freeTime,
|
|
xp.max_fee as maxFee,
|
|
xp.content as content,
|
|
xcs.name as chargingStationName,
|
|
xp.charging_station_id as chargingStationId,
|
|
xp.internet_user_id as internetUserId,
|
|
xp.user_type as userType,
|
|
xp.ykc_status as ykcStatus,
|
|
(select group_concat(inu.name separator ',')
|
|
from xhpc_internet_user inu
|
|
where find_in_set(inu.internet_user_id, xp.internet_user_id) > 0
|
|
) as internetUserNames
|
|
from xhpc_placeholder xp
|
|
left join xhpc_charging_station xcs on xcs.charging_station_id = xp.charging_station_id
|
|
where xp.del_flag=0 and xp.placeholder_id =#{placeholderId}
|
|
</select>
|
|
|
|
<select id="getXhpcPlaceholderTimeList" resultType="map">
|
|
select
|
|
start_time as startTime,
|
|
replace(end_time, '00:00:00', '24:00:00') as endTime,
|
|
price as price
|
|
from xhpc_placeholder_time
|
|
where placeholder_id=#{placeholderId} and del_flag =0
|
|
</select>
|
|
|
|
<update id="updateXhpcPlaceholder">
|
|
update xhpc_placeholder
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="startTime != null">start_time = #{startTime},</if>
|
|
<if test="endTime != null ">end_time = #{endTime},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="type != null">type = #{type},</if>
|
|
<if test="content != null and content !=''">content = #{content},</if>
|
|
<if test="maxFee != null and maxFee !=''">max_fee = #{maxFee},</if>
|
|
<if test="freeTime != null and freeTime !=''">free_time = #{freeTime},</if>
|
|
<if test="delFlag != null">del_flag = #{delFlag},</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="internetUserId != null and internetUserId !=''">internet_user_id = #{internetUserId},</if>
|
|
<if test="userType != null and userType !=''">user_type = #{userType},</if>
|
|
<if test="null != ykcStatus "> ykc_status = #{ykcStatus},</if>
|
|
</trim>
|
|
where placeholder_id = #{placeholderId}
|
|
</update>
|
|
|
|
<update id="updateXhpcPlaceholderTime">
|
|
update xhpc_placeholder_time set del_flag =1 where placeholder_id=#{placeholderId}
|
|
</update>
|
|
|
|
<insert id="insertXhpcPlaceholderTime">
|
|
insert into xhpc_placeholder_time
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="null != placeholderId ">
|
|
placeholder_id,
|
|
</if>
|
|
<if test="null != startTime">
|
|
start_time,
|
|
</if>
|
|
<if test="null != endTime">
|
|
end_time,
|
|
</if>
|
|
<if test="null != price ">
|
|
price,
|
|
</if>
|
|
<if test="null != chargingStationId ">
|
|
charging_station_id,
|
|
</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 != tenantId and '' != tenantId">
|
|
tenant_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="null != placeholderId ">
|
|
#{placeholderId},
|
|
</if>
|
|
<if test="null != startTime">
|
|
#{startTime},
|
|
</if>
|
|
<if test="null != endTime">
|
|
#{endTime},
|
|
</if>
|
|
<if test="null != price ">
|
|
#{price},
|
|
</if>
|
|
<if test="null != chargingStationId ">
|
|
#{chargingStationId},
|
|
</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 != tenantId and '' != tenantId">
|
|
#{tenantId},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<insert id="insertXhpcPlaceholder" parameterType="com.xhpc.common.domain.XhpcPlaceholder"
|
|
useGeneratedKeys="true" keyProperty="placeholderId">
|
|
insert into xhpc_placeholder
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<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 != maxFee ">
|
|
max_fee,
|
|
</if>
|
|
<if test="null != freeTime ">
|
|
free_time,
|
|
</if>
|
|
<if test="null != content and content !=''">
|
|
content,
|
|
</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 != tenantId and '' != tenantId">
|
|
tenant_id,
|
|
</if>
|
|
<if test="null != status ">
|
|
status,
|
|
</if>
|
|
<if test="null != internetUserId and '' != internetUserId">
|
|
internet_user_id,
|
|
</if>
|
|
<if test="null != userType and '' != userType">
|
|
user_type,
|
|
</if>
|
|
<if test="null != type ">
|
|
type,
|
|
</if>
|
|
<if test="null != ykcStatus ">
|
|
ykc_status,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="null != chargingStationId ">
|
|
#{chargingStationId},
|
|
</if>
|
|
<if test="null != startTime ">
|
|
#{startTime},
|
|
</if>
|
|
<if test="null != endTime ">
|
|
#{endTime},
|
|
</if>
|
|
<if test="null != maxFee ">
|
|
#{maxFee},
|
|
</if>
|
|
<if test="null != freeTime ">
|
|
#{freeTime},
|
|
</if>
|
|
<if test="null != content and content !=''">
|
|
#{content},
|
|
</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 != tenantId and '' != tenantId">
|
|
#{tenantId},
|
|
</if>
|
|
<if test="null != status ">
|
|
#{status},
|
|
</if>
|
|
<if test="null != internetUserId and '' != internetUserId">
|
|
#{internetUserId},
|
|
</if>
|
|
<if test="userType != null and userType !=''">
|
|
#{userType},
|
|
</if>
|
|
<if test="null != type ">
|
|
#{type},
|
|
</if>
|
|
<if test="null != ykcStatus ">
|
|
#{ykcStatus},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<select id="getXhpcPlaceholderChargingStationId" resultType="int">
|
|
select count(*) from xhpc_placeholder where charging_station_id=#{chargingStationId} and del_flag =0
|
|
<if test="type ==2">
|
|
and placeholder_id !=#{placeholderId}
|
|
</if>
|
|
</select>
|
|
</mapper>
|