501 lines
17 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.XhpcRequirementMapper">
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.Requirement">
<result property="requirementId" column="requirement_id"/>
<result property="name" column="name"/>
<result property="area" column="area"/>
<result property="code" column="code"/>
<result property="requireDate" column="require_date"/>
<result property="deliveryTime" column="delivery_time"/>
<result property="releaseTime" column="release_time"/>
<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="getLsit" resultType="map">
select
requirement_id as requirementId,
name as name,
area as area,
code as code,
status as status,
require_date as requireDate,
delivery_time as deliveryTime,
release_time as releaseTime,
create_time as createTime
from xhpc_requirement where del_flag =0
<if test="params.name !=null and params.name !=''">
and name like CONCAT('%',#{params.name},'%')
</if>
<if test="params.area !=null and params.area !=''">
and area like CONCAT('%',#{params.area},'%')
</if>
<if test="params.code !=null and params.code !=''">
and code like CONCAT('%',#{params.code},'%')
</if>
order by create_time desc
</select>
<select id="getRequirementById" resultType="map">
select
name as name,
area as area,
code as code,
require_date as requireDate,
delivery_time as deliveryTime,
release_time as releaseTime,
create_time as createTime
from xhpc_requirement
where requirement_id = #{requirementId}
</select>
<select id="getRequirementTaskById" resultType="map">
select
xrt.requirement_task_id as requirementTaskId,
xrt.task_name as taskName,
xrt.task_code as taskCode,
xrt.demand_date as demandDate,
GROUP_CONCAT(s.name) as stationName,
xrt.status as status,
xrt.operator_id as operatorID,
xrt.equipment_owner_id as equipmentOwnerID,
xrt.ele_no as eleNo,
xrt.delivery_time as deliveryTime,
xrt.create_time as createTime
from xhpc_requirement_task as xrt
left join xhpc_charging_station as s on FIND_IN_SET(CAST(s.charging_station_id AS CHAR), xrt.station_id) > 0
where xrt.del_flag =0 and xrt.requirement_task_id=#{requirementTaskId}
</select>
<update id="updateTaskById">
update xhpc_requirement_task set status =#{status} where requirement_task_id=#{requirementTaskId}
</update>
<select id="getRequirementTimeList" resultType="map">
select
requirement_time_id as id,
start_time as startTime,
end_time as endTime,
res as res
from xhpc_requirement_time
where del_flag=0
<if test="requirementId !=null">
and requirement_id = #{requirementId}
</if>
<if test="requirementTaskId !=null">
and requirement_task_id = #{requirementTaskId}
</if>
</select>
<insert id="addRequirement" keyColumn="requirement_id" keyProperty="requirementId"
parameterType="com.xhpc.common.domain.Requirement"
useGeneratedKeys="true">
insert into xhpc_requirement
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != name and ''!=name">
name,
</if>
<if test="null != area and ''!=area">
area,
</if>
<if test="null != code and ''!=code">
code,
</if>
<if test="null != requireDate ">
require_date,
</if>
<if test="null != releaseTime ">
release_time,
</if>
<if test="null != deliveryTime ">
delivery_time,
</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 != tenantId ">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != name and ''!=name">
#{name},
</if>
<if test="null != area and ''!=area">
#{area},
</if>
<if test="null != code and ''!=code">
#{code},
</if>
<if test="null != requireDate ">
#{requireDate},
</if>
<if test="null != releaseTime ">
#{releaseTime},
</if>
<if test="null != deliveryTime ">
#{deliveryTime},
</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 != tenantId ">
#{tenantId},
</if>
</trim>
</insert>
<insert id="addRequirementTime">
insert into xhpc_requirement_time
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != startTime">
start_time,
</if>
<if test="null != endTime">
end_time,
</if>
<if test="null != res">
res,
</if>
<if test="null != requirementId">
requirement_id,
</if>
<if test="null != requirementTaskId">
requirement_task_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 != tenantId ">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != startTime">
#{startTime},
</if>
<if test="null != endTime">
#{endTime},
</if>
<if test="null != res">
#{res},
</if>
<if test="null != requirementId">
#{requirementId},
</if>
<if test="null != requirementTaskId">
#{requirementTaskId},
</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 != tenantId ">
#{tenantId},
</if>
</trim>
</insert>
<insert id="addRequirementTask" keyColumn="requirement_task_id" keyProperty="requirementTaskId"
parameterType="com.xhpc.common.domain.RequirementTask"
useGeneratedKeys="true">
insert into xhpc_requirement_task
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != taskName and '' !=taskName ">
task_name,
</if>
<if test="null != taskCode and '' !=taskCode ">
task_code,
</if>
<if test="null != demandDate">
demand_date,
</if>
<if test="null != stationID and '' !=stationID ">
station_id,
</if>
<if test="null != operatorID and '' !=operatorID ">
operator_id,
</if>
<if test="null != eleNo and '' !=eleNo ">
ele_no,
</if>
<if test="null != equipmentOwnerID and '' !=equipmentOwnerID ">
equipment_owner_id,
</if>
<if test="null != deliveryTime ">
delivery_time,
</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 != tenantId ">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != taskName and '' !=taskName ">
#{taskName},
</if>
<if test="null != taskCode and '' !=taskCode ">
#{taskCode},
</if>
<if test="null != demandDate">
#{demandDate},
</if>
<if test="null != stationID and '' !=stationID ">
#{stationID},
</if>
<if test="null != operatorID and '' !=operatorID ">
#{operatorID},
</if>
<if test="null != eleNo and '' !=eleNo ">
#{eleNo},
</if>
<if test="null != equipmentOwnerID and '' !=equipmentOwnerID ">
#{equipmentOwnerID},
</if>
<if test="null != deliveryTime ">
#{deliveryTime},
</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 != tenantId ">
#{tenantId},
</if>
</trim>
</insert>
<select id="getTaskList" resultType="map">
select
xrt.requirement_task_id as requirementTaskId,
xrt.task_name as taskName,
xrt.task_code as taskCode,
xrt.demand_date as demandDate,
GROUP_CONCAT(s.name) as stationName,
xrt.status as status,
xrt.operator_id as operatorID,
xrt.equipment_owner_id as equipmentOwnerID,
xrt.ele_no as eleNo,
xrt.delivery_time as deliveryTime,
xrt.create_time as createTime
from xhpc_requirement_task as xrt
left join xhpc_charging_station as s on FIND_IN_SET(CAST(s.charging_station_id AS CHAR), xrt.station_id) > 0
where xrt.del_flag =0
<if test="params.taskName !=null and params.taskName !=''">
and xrt.ask_name like CONCAT('%',#{params.taskName},'%')
</if>
<if test="params.taskCode !=null and params.taskCode !=''">
and xrt.task_code like CONCAT('%',#{params.taskCode},'%')
</if>
<if test="params.demandDate !=null and params.demandDate !=''">
and xrt.demand_date like CONCAT('%',#{params.demandDate},'%')
</if>
<if test="params.stationId !=null and params.stationId !=''">
and FIND_IN_SET(CAST(#{params.stationId} AS CHAR), xrt.station_id) > 0
</if>
<if test="params.operatorID !=null and params.operatorID !=''">
and xrt.demand_date =#{params.operatorID}
</if>
<if test="params.equipmentOwnerID !=null and params.equipmentOwnerID !=''">
and xrt.delivery_time =#{params.equipmentOwnerID}
</if>
<if test="params.eleNo !=null and params.eleNo !=''">
and xrt.ele_no like CONCAT('%',#{params.eleNo},'%')
</if>
order by xrt.create_time desc
</select>
<update id="updateBarrierGate">
update xhpc_barrier_gate
<trim prefix="SET" suffixOverrides=",">
<if test="null != barrierGateCompany and ''!=barrierGateCompany">
barrier_gate_company=#{barrierGateCompany},
</if>
<if test="null != startTime">
start_time=#{startTime},
</if>
<if test="null != endTime ">
end_time=#{endTime},
</if>
<if test="null != status">
status=#{status},
</if>
<if test="null != delFlag ">
del_flag = #{delFlag},
</if>
<if test="null != createTime ">
create_time = #{createTime},
</if>
<if test="null != createBy and '' != createBy">
create_by = #{createBy},
</if>
<if test="null != updateTime ">
update_time = #{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
update_by =#{updateBy},
</if>
<if test="null != remark and '' != remark">
remark =#{remark},
</if>
<if test="null != tenantId ">
tenant_id =#{tenantId},
</if>
<if test="null != tenantId ">
tenant_id =#{tenantId},
</if>
<if test="null != chargingStationNumber and ''!=chargingStationNumber ">
charging_station_number =#{chargingStationNumber},
</if>
<if test="null != url and ''!=url ">
url=#{url},
</if>
</trim>
where barrier_gate_id = #{barrierGateId}
</update>
<update id="deleteBarrierGateById">
update xhpc_barrier_gate set del_flag =1 where barrier_gate_id = #{barrierGateId}
</update>
<select id="getXhpcBarrierGateById" resultType="map">
select
barrier_gate_id as barrierGateId,
barrier_gate_company as barrierGateCompany,
charging_station_number as chargingStationNumber,
url as url,
start_time as startTime,
end_time as endTime
from xhpc_barrier_gate
where barrier_gate_id = #{barrierGateId}
</select>
<select id="getBarrierGateEndTime" resultType="Long">
select barrier_gate_id as barrierGateId from xhpc_barrier_gate where end_time &lt; #{date}
</select>
<update id="updateBarrierGateStatus">
update xhpc_barrier_gate set status =1 where barrier_gate_id = #{barrierGateId}
</update>
</mapper>