select id, stake_mark stakeMark, direction, dept_id deptId,
warning_state warningState,vehicle_type vehicleType,
DATE_FORMAT(warning_time,'%Y-%m-%d %H:%i:%s')warningTime,
user_id userId, warning_source warningSource, warning_level warningLevel,
remark, DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s')createTime,
DATE_FORMAT(update_time,'%Y-%m-%d %H:%i:%s')updateTime,
warning_type warningType, warning_subclass warningSubclass, warning_title warningTitle,
other_config otherConfig, lane from dc_warning
and stake_mark = #{stakeMark}
and direction = #{direction}
and dept_id = #{deptId}
and warning_state = #{warningState}
and warning_time = #{warningTime}
and user_id = #{userId}
and warning_source = #{warningSource}
and warning_level = #{warningLevel}
and warning_type = #{warningType}
and warning_subclass = #{warningSubclass}
and warning_title = #{warningTitle}
and other_config = #{otherConfig}
and lane = #{lane}
and date_format(warning_time,'%Y-%m-%d') >= #{startDate}
and date_format(warning_time,'%Y-%m-%d') <= #{endDate}
select count(*) from dc_warning
warning_source = #{warningSource}
where id = #{id}
where warning_source = '5' and JSON_EXTRACT(other_config, '$.id') = #{alarmId};
SELECT facility.facility_name,
warning.`id`,warning.`stake_mark`, warning.`direction`,warning.end_time,warning.event_cause,
warning.lane,warning.vehicle_type,mark.longitude,mark.latitude,
warning.`dept_id`,warning.`warning_state`,warning.`warning_time`,
warning.`auditor`,warning.`audit_time`,IFNULL(warning.`audit_flag`, 0) AS `audit_flag`,
warning.`user_id`, warning.`warning_source`,warning.`warning_level`,
warning.`remark`, warning.`create_time`,warning.`update_time`,
warning.`warning_type`,warning.`warning_subclass`,warning.`warning_title`,
warning.`other_config` FROM dc_warning AS warning
LEFT JOIN dc_stake_mark AS mark ON mark.stake_mark=warning.stake_mark and warning.direction =mark.direction
left join dc_facility as facility on facility.stake_mark=warning.stake_mark and facility.facility_type=1
and facility.facility_name like concat('%', #{facilityName}, '%')
and warning.warning_source !=6
and warning.warning_source = #{warningSource}
and warning.warning_state = #{warningState}
and warning.warning_type = #{warningType}
and warning.warning_subclass =
#{warningSubclass}
and warning.direction = #{direction}
and warning.audit_flag = #{auditFlag}
and warning.stake_mark = #{stakeMark}
and warning.warning_time between #{startTime} and #{completeTime}
and CAST(SUBSTRING(SUBSTRING_INDEX(warning.stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(warning.stake_mark, '+', -1) AS UNSIGNED)>#{startStakeMark}
and CAST(SUBSTRING(SUBSTRING_INDEX(warning.stake_mark,'+',1),2)AS UNSIGNED)*1000
+CAST(SUBSTRING_INDEX(warning.stake_mark, '+', -1) AS UNSIGNED)<#{endStakeMark}
order by warning.warning_time desc
insert into dc_warning
id,
stake_mark,
direction,
dept_id,
warning_state,
warning_time,
user_id,
warning_source,
warning_level,
remark,
create_time,
update_time,
warning_type,
warning_subclass,
warning_title,
other_config,
lane,
vehicle_type,
end_time,
#{id},
#{stakeMark},
#{direction},
#{deptId},
#{warningState},
#{warningTime},
#{userId},
#{warningSource},
#{warningLevel},
#{remark},
#{createTime},
#{updateTime},
#{warningType},
#{warningSubclass},
#{warningTitle},
#{otherConfig},
#{lane},
#{vehicleType},
#{endTime},
insert into dc_dispatch_resource
id,
dispatch_type,
resource_id,
dispatch_id,
#{id},
#{dispatchType},
#{resourceId},
#{dispatchId},
insert into dc_dispatch
id,
organization_id,
event_id,
dispatch_name,
dispatch_status,
start_time,
end_time,
remark,
dept_id,
#{id},
#{organizationId},
#{eventId},
#{dispatchName},
#{dispatchStatus},
#{startTime},
#{endTime},
#{remark},
#{deptId},
update dc_warning
stake_mark = #{stakeMark},
direction = #{direction},
dept_id = #{deptId},
warning_state = #{warningState},
warning_time = #{warningTime},
user_id = #{userId},
warning_source = #{warningSource},
warning_level = #{warningLevel},
remark = #{remark},
create_time = #{createTime},
update_time = #{updateTime},
warning_type = #{warningType},
warning_subclass = #{warningSubclass},
warning_title = #{warningTitle},
other_config = #{otherConfig},
lane = #{lane},
vehicle_type = #{vehicleType},
where id = #{id}
update dc_warning set warning_state=2,user_id=#{userId} where id=#{id}
update dc_warning set warning_state = 2,user_id = #{userId}
where id in
#{item.id}
update dc_warning set other_config=#{otherConfig},update_time=now(),end_time=#{endTime} where id=#{id}
update dc_warning set warning_state = 4
where id in
#{item.id}
update dc_dispatch set organization_id=#{organization_id} where id=#{id}
update dc_warning
relieve_reason = #{relieveReason},
relieve_type = #{relieveType},
update_time = #{updateTime},
user_id = #{userId},
warning_state=3
where id = #{id}
delete from dc_warning where id = #{id}
delete from dc_warning where id= #{id}
delete from dc_warning where id= #{id}
delete from dc_warning
where id in
#{item.id}
delete from dc_dispatch_resource where dispatch_id=#{dispatchId}
SELECT COUNT(*)AS count FROM dc_warning
SELECT id,stake_mark,warning_type,warning_subclass, other_config->'$.coordinate' AS coordinate ,other_config->'$.targetId' AS targetId
FROM dc_warning
and stake_mark = #{stakeMark}
and warning_state = #{warningState}
and warning_source = #{warningSource}
and warning_type = #{warningType}
and warning_subclass = #{warningSubclass}
select id, warning_source, warning_type, warning_subclass, strategy,priority,
strategy_time, create_by, create_time,
update_by, update_time from dc_waring_strategy
and warning_source = #{warningSource}
and warning_type = #{warningType}
and warning_subclass = #{warningSubclass}
and strategy = #{strategy}
select id from dc_warning where YEAR(end_time) = YEAR(CURDATE()) and warning_state!=4 and now()>end_time
select section_id from dc_satke_mark where stake_mark=#{stakeMark} and direction=#{direction}
select id,organization_name organizationName,stake_mark stakeMark from dc_organization
where parent_id!=0
select id, name,contact_number contactNumber from dc_employees where organization_id=#{organizationId}
select shifts.scheduling,employees.name shiftsName,employees.contact_number shiftsNumber from dc_shifts as shifts
left join dc_employees as employees on shifts.employees_id=employees.id
where shifts.station=#{station} and DATE(date) = CURDATE();
select id,vehicle_type vehicleType,vehicle_plate vehiclePlate from dc_vehicles
where vehicle_status=1 and organization_id=#{organizationId}
select dc_dispatch.id id,sys_dept.dept_name deptName
from dc_dispatch
left join dc_organization on dc_dispatch.organization_id=dc_organization.id
LEFT JOIN sys_dept on sys_dept.dept_id=dc_dispatch.dept_id
where event_id=#{eventId}
SELECT DISTINCT
dc_dispatch_resource.resource_id resourceId,
dc_dispatch_resource.dispatch_type dispatchType,
CASE
WHEN dc_dispatch_resource.dispatch_type = 1 THEN dc_employees.name
WHEN dc_dispatch_resource.dispatch_type = 2 THEN dc_vehicles.vehicle_type
ELSE NULL
END AS resourceName,
CASE
WHEN dc_dispatch_resource.dispatch_type = 1 THEN dc_employees.contact_number
WHEN dc_dispatch_resource.dispatch_type = 2 THEN dc_vehicles.vehicle_plate
ELSE NULL
END AS resourceValue
FROM
dc_dispatch_resource
LEFT JOIN dc_employees ON dc_dispatch_resource.resource_id = dc_employees.id AND dc_dispatch_resource.dispatch_type = 1
LEFT JOIN dc_vehicles ON dc_dispatch_resource.resource_id = dc_vehicles.id AND dc_dispatch_resource.dispatch_type = 2
where dc_dispatch_resource.dispatch_id=#{dispatchId}
select DISTINCT employees.name shiftsName,employees.contact_number shiftsNumber from dc_shifts as shifts
left join dc_employees as employees on shifts.employees_id=employees.id
where DATE(date) = CURDATE();
select shifts.name shiftsName,shifts.contact_number shiftsNumber
from dc_employees as shifts
SELECT DISTINCT dc_employees.id,
dc_employees.name,
dc_employees.contact_number AS contactNumber
from dc_employees
LEFT JOIN(
select employees.id id, employees.name, employees.contact_number contactNumber
from dc_employees as employees
left JOIN dc_dispatch_resource as respurce on respurce.resource_id = employees.id
LEFT JOIN dc_dispatch as path on path.id = respurce.dispatch_id
where employees.organization_id = #{organizationId}
and respurce.dispatch_type = 1
and path.event_id = #{eventId}) as t on t.id = dc_employees.id
where organization_id = #{organizationId}
select DISTINCT dc_vehicles.id,
dc_vehicles.vehicle_type vehicleType,
dc_vehicles.vehicle_plate vehiclePlate
from dc_vehicles
LEFT JOIN(
select vehicles.id, vehicles.vehicle_type vehicleType, vehicles.vehicle_plate vehiclePlate
from dc_vehicles as vehicles
LEFT JOIN dc_dispatch_resource as resource on resource.resource_id = vehicles.id
LEFT JOIN dc_dispatch as path on path.id = resource.dispatch_id
where vehicles.organization_id = #{organizationId}
and resource.dispatch_type = 2
and path.event_id = #{eventId}) as t on t.id = dc_vehicles.id
where vehicle_status = 1
and organization_id = #{organizationId} and dc_vehicles.vehicle_status = 1
select id from dc_organization where parent_id=0;
select DISTINCT employees.id,employees.`name` from dc_dispatch_resource as resource
LEFT JOIN dc_employees as employees on resource.resource_id=employees.id
WHERE resource.dispatch_id=#{dispatchId} and resource.dispatch_type=1
select DISTINCT vehicle.id,vehicle.vehicle_type vehicleType,vehicle.vehicle_plate vehiclePlate from dc_dispatch_resource as resource
LEFT JOIN dc_vehicles as vehicle on resource.resource_id=vehicle.id
WHERE resource.dispatch_id=#{dispatchId} and resource.dispatch_type=2
select * from dc_dispatch where id = #{id}
select name from dc_employees where id=#{id}
select vehicle_plate from dc_vehicles where id=#{id}
select organization_name from dc_organization where id=#{id}
select vehicle_type from dc_vehicles where id=#{id}
select id dispatchId from dc_dispatch where event_id=#{eventId}
select count(*) from dc_warning where warning_state = 1 and warning_source != 6
select id from dc_event where id=#{eventId}
SELECT 'Traffic Flow' AS WarningTypeSource, id, warning_description, warning_type, warning_time, create_time, other_config
FROM dc_no_stake_warning_table
WHERE warning_type = 1
AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 14 DAY)
UNION ALL
SELECT 'Weather Warning' AS WarningTypeSource, id, warning_description, warning_type, warning_time, create_time, other_config
FROM dc_no_stake_warning_table
WHERE warning_type = 2 AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 3 DAY)
UNION ALL
SELECT 'TrafficFlow' AS WarningTypeSource, id, warning_description, warning_type, warning_time, create_time, other_config
FROM dc_no_stake_warning_table
WHERE warning_type = 3
AND warning_time >= DATE_SUB(CURDATE(), INTERVAL 2 DAY)
ORDER BY warning_time DESC
select id, stake_mark, warning_type, warning_subclass, audit_flag,warning_source
from dc_warning
and stake_mark BETWEEN #{stakeMark} and #{endStakeMark}
and direction = #{direction}
and dept_id = #{deptId}
and warning_state = #{warningState}
and warning_time = #{warningTime}
and user_id = #{userId}
and warning_source in
#{item}
and warning_level = #{warningLevel}
and warning_type = #{warningType}
and warning_subclass = #{warningSubclass}
and warning_title = #{warningTitle}
and other_config = #{otherConfig}
and lane = #{lane}
and date_format(audit_time, '%Y-%m-%d') >= #{startDate}
and date_format(audit_time,'%Y-%m-%d') <= #{endDate}
and audit_flag = #{auditFlag}
select id, stake_mark, warning_type, warning_subclass, audit_flag,warning_source,audit_time
from dc_warning
(audit_flag = '1' OR audit_flag = '2')
and stake_mark BETWEEN #{startStakeMark} and #{endStakeMark}
and direction = #{direction}
and dept_id = #{deptId}
and warning_state = #{warningState}
and warning_time = #{warningTime}
and user_id = #{userId}
and warning_source in
#{item}
and warning_level = #{warningLevel}
and warning_type = #{warningType}
and warning_subclass = #{warningSubclass}
and warning_title = #{warningTitle}
and other_config = #{otherConfig}
and lane = #{lane}
and date_format(audit_time, '%Y-%m-%d') >= #{startDate}
and date_format(audit_time,'%Y-%m-%d') <= #{endDate}
select id, stake_mark, warning_type, warning_subclass, audit_flag,warning_source,audit_time
from dc_warning
(audit_flag = '1' OR audit_flag = '2')
and stake_mark BETWEEN #{startStakeMark} and #{endStakeMark}
and direction = #{direction}
and dept_id = #{deptId}
and warning_state = #{warningState}
and warning_time = #{warningTime}
and user_id = #{userId}
and warning_source in
#{item}
and warning_level = #{warningLevel}
and warning_type = #{warningType}
and warning_subclass = #{warningSubclass}
and warning_title = #{warningTitle}
and other_config = #{otherConfig}
and lane = #{lane}
YEAR(dg.statistical_date) = #{startDate}
DATE_FORMAT(dg.statistical_date, '%Y-%m') = #{startDate}