Commit 324bea6b authored by duanruiming's avatar duanruiming

[add] 国产化数据库改造

parent 42929683
......@@ -2,14 +2,16 @@ spring:
cloud:
nacos:
config:
server-addr: 37.12.182.29:8848
server-addr: 37.8.219.227:28848
file-extension: yaml
group: signal
namespace: signal
username: nacos
password: nacos
password: Nacos@2025
application:
# dubbo启动需要程序名称
name: signal-optimize-service
main:
allow-circular-references: true
inforsuite:
license-path: D:\license
\ No newline at end of file
spring:
cloud:
nacos:
config:
server-addr: 37.8.219.227:28848
file-extension: yaml
group: signal
namespace: signal
username: nacos
password: Nacos@2025
application:
# dubbo启动需要程序名称
name: signal-optimize-service
main:
allow-circular-references: true
inforsuite:
license-path: D:\license
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemGreenDayMapper">
<!-- 通用设置 -->
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
id, area_id, event_category, event_type, event_number, event_total_time, window_start_time, window_end_time, green_id, dt, insert_time
......@@ -10,88 +10,88 @@
<!-- 通用条件列 -->
<sql id="AnalysisProblemGreenDayByCondition">
<if test="id!=null and id!=''">
AND id = #{id}
</if>
<if test="areaId!=null and areaId!=''">
AND area_id = #{areaId}
</if>
<if test="eventCategory!=null and eventCategory!=''">
AND event_category = #{eventCategory}
</if>
<if test="eventType!=null and eventType!=''">
AND event_type = #{eventType}
</if>
<if test="eventNumber!=null and eventNumber!=''">
AND event_number = #{eventNumber}
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
AND event_total_time = #{eventTotalTime}
</if>
<if test="windowStartTime!=null">
AND window_start_time = #{windowStartTime}
</if>
<if test="windowEndTime!=null">
AND window_end_time = #{windowEndTime}
</if>
<if test="greenId!=null and greenId!=''">
AND green_id = #{greenId}
</if>
<if test="dt!=null and dt!=''">
AND dt = #{dt}
</if>
<if test="insertTime!=null">
AND insert_time = #{insertTime}
</if>
<if test="id!=null and id!=''">
AND id = #{id}
</if>
<if test="areaId!=null and areaId!=''">
AND area_id = #{areaId}
</if>
<if test="eventCategory!=null and eventCategory!=''">
AND event_category = #{eventCategory}
</if>
<if test="eventType!=null and eventType!=''">
AND event_type = #{eventType}
</if>
<if test="eventNumber!=null and eventNumber!=''">
AND event_number = #{eventNumber}
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
AND event_total_time = #{eventTotalTime}
</if>
<if test="windowStartTime!=null">
AND window_start_time = #{windowStartTime}
</if>
<if test="windowEndTime!=null">
AND window_end_time = #{windowEndTime}
</if>
<if test="greenId!=null and greenId!=''">
AND green_id = #{greenId}
</if>
<if test="dt!=null and dt!=''">
AND dt = #{dt}
</if>
<if test="insertTime!=null">
AND insert_time = #{insertTime}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="AnalysisProblemGreenDaySetColumns">
<if test="areaId!=null and areaId!=''">
area_id = #{areaId},
</if>
<if test="eventCategory!=null and eventCategory!=''">
event_category = #{eventCategory},
</if>
<if test="eventType!=null and eventType!=''">
event_type = #{eventType},
</if>
<if test="eventNumber!=null and eventNumber!=''">
event_number = #{eventNumber},
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
event_total_time = #{eventTotalTime},
</if>
<if test="windowStartTime!=null">
window_start_time = #{windowStartTime},
</if>
<if test="windowEndTime!=null">
window_end_time = #{windowEndTime},
</if>
<if test="greenId!=null and greenId!=''">
green_id = #{greenId},
</if>
<if test="dt!=null and dt!=''">
dt = #{dt},
</if>
<if test="insertTime!=null">
insert_time = #{insertTime},
</if>
<if test="areaId!=null and areaId!=''">
area_id = #{areaId},
</if>
<if test="eventCategory!=null and eventCategory!=''">
event_category = #{eventCategory},
</if>
<if test="eventType!=null and eventType!=''">
event_type = #{eventType},
</if>
<if test="eventNumber!=null and eventNumber!=''">
event_number = #{eventNumber},
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
event_total_time = #{eventTotalTime},
</if>
<if test="windowStartTime!=null">
window_start_time = #{windowStartTime},
</if>
<if test="windowEndTime!=null">
window_end_time = #{windowEndTime},
</if>
<if test="greenId!=null and greenId!=''">
green_id = #{greenId},
</if>
<if test="dt!=null and dt!=''">
dt = #{dt},
</if>
<if test="insertTime!=null">
insert_time = #{insertTime},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="AnalysisProblemGreenDayMap" type="net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenDay">
<id column="id" property="id"/>
<result column="area_id" property="areaId"/>
<result column="event_category" property="eventCategory"/>
<result column="event_type" property="eventType"/>
<result column="event_number" property="eventNumber"/>
<result column="event_total_time" property="eventTotalTime"/>
<result column="window_start_time" property="windowStartTime"/>
<result column="window_end_time" property="windowEndTime"/>
<result column="green_id" property="greenId"/>
<result column="dt" property="dt"/>
<result column="insert_time" property="insertTime"/>
<id column="id" property="id"/>
<result column="area_id" property="areaId"/>
<result column="event_category" property="eventCategory"/>
<result column="event_type" property="eventType"/>
<result column="event_number" property="eventNumber"/>
<result column="event_total_time" property="eventTotalTime"/>
<result column="window_start_time" property="windowStartTime"/>
<result column="window_end_time" property="windowEndTime"/>
<result column="green_id" property="greenId"/>
<result column="dt" property="dt"/>
<result column="insert_time" property="insertTime"/>
</resultMap>
<!-- 查询表t_analysis_problem_green_day所有信息 -->
......@@ -121,7 +121,7 @@
<!-- 根据主键id删除表t_analysis_problem_green_day信息 -->
<delete id="deleteAnalysisProblemGreenDayByid">
DELETE FROM
t_analysis_problem_green_day
t_analysis_problem_green_day
WHERE id=#{id}
</delete>
......@@ -138,30 +138,30 @@
<!-- 新增表t_analysis_problem_green_day信息 -->
<insert id="addAnalysisProblemGreenDay">
INSERT INTO t_analysis_problem_green_day (
id
,area_id
,event_category
,event_type
,event_number
,event_total_time
,window_start_time
,window_end_time
,green_id
,dt
,insert_time
id
,area_id
,event_category
,event_type
,event_number
,event_total_time
,window_start_time
,window_end_time
,green_id
,dt
,insert_time
) VALUES (
#{id}
,#{areaId}
,#{eventCategory}
,#{eventType}
,#{eventNumber}
,#{eventTotalTime}
,#{windowStartTime}
,#{windowEndTime}
,#{greenId}
,#{dt}
,#{insertTime}
)
#{id}
,#{areaId}
,#{eventCategory}
,#{eventType}
,#{eventNumber}
,#{eventTotalTime}
,#{windowStartTime}
,#{windowEndTime}
,#{greenId}
,#{dt}
,#{insertTime}
)
</insert>
<!-- 新增表t_analysis_problem_green_day信息 -->
......@@ -191,25 +191,25 @@
<insert id="insertAnalysisProblemGreenHour">
insert into t_analysis_problem_green_hour (id,green_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time)
select uuid(), d.green_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2,
DATE_FORMAT(now(),'%Y%m%d') as dt , now()
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2,
DATE_FORMAT(now(),'%Y%m%d') as dt , now()
from
(select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir
from
(select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir
from t_event_info a
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and a.type in (705,706) and a.green_id != ''
(select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir
from
(select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir
from t_event_info a
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and a.type in (705,706) and a.green_id != ''
and a.dir is not null
and length(a.dir)>2
) b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1
)) d
left join t_greenwave_info e on d.green_id = e.id
) b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1
)) d
left join t_greenwave_info e on d.green_id = e.id
group by d.green_id, e.area_id,d.category,d.type,d.dir
ON DUPLICATE KEY UPDATE
ON DUPLICATE KEY UPDATE
id=VALUES(id),
green_id=VALUES(green_id),
area_id=VALUES(area_id),
......@@ -226,53 +226,59 @@
</insert>
<!-- 根据条件查询表t_analysis_problem_green_day信息 -->
<!-- <select id="checkData" resultMap="AnalysisProblemGreenDayMap">-->
<!-- SELECT dt-->
<!-- FROM t_analysis_problem_green_day-->
<!-- WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')-->
<!-- </select>-->
<select id="checkData" resultMap="AnalysisProblemGreenDayMap">
SELECT dt
FROM t_analysis_problem_green_day
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')
WHERE dt = to_char(CURRENT_DATE - INTERVAL '1 day', 'YYYYMMDD') :: INTEGER
</select>
<select id="getListGreenByProblemSum" parameterType="map" resultMap="AnalysisProblemGreenDayMap">
SELECT
sum(t1.event_number) as event_number,
sum(event_total_time) as event_total_time,
t1.event_type,
t2.label as typeName
FROM t_analysis_problem_green_day t1
SELECT
sum(t1.event_number) as event_number,
sum(event_total_time) as event_total_time,
t1.event_type,
t2.label as typeName
FROM t_analysis_problem_green_day t1
LEFT JOIN t_config_event_category t2 on t1.event_type=t2.event_type
WHERE
1=1
<if test="startTime!=null and endTime!=''">
<![CDATA[
WHERE
1=1
<if test="startTime!=null and endTime!=''">
<![CDATA[
AND dt>=#{startTime} AND dt<=#{endTime}
]]>
</if>
<if test="greenId!=null and greenId!=''">
AND t1.green_id=#{greenId}
</if>
GROUP BY
t1.event_type
</if>
<if test="greenId!=null and greenId!=''">
AND t1.green_id=#{greenId}
</if>
GROUP BY
t1.event_type
</select>
<select id="getListGreenByProblemTrend" parameterType="map" resultMap="AnalysisProblemGreenDayMap">
SELECT
dt,
sum( event_number ) AS event_number,
sum(event_total_time) As event_total_time,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_green_day t1
JOIN t_config_event_category t2 ON t1.event_type = t2.event_type
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
</if>
<if test="greenId != null and greenId != ''">
and t1.green_id = #{greenId}
</if>
GROUP BY dt, t1.event_type
ORDER BY dt
</select>
<select id="getListGreenByProblemTrend" parameterType="map" resultMap="AnalysisProblemGreenDayMap">
SELECT
dt,
sum( event_number ) AS event_number,
sum(event_total_time) As event_total_time,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_green_day t1
JOIN t_config_event_category t2 ON t1.event_type = t2.event_type
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
</if>
<if test="greenId != null and greenId != ''">
and t1.green_id = #{greenId}
</if>
GROUP BY dt, t1.event_type
ORDER BY dt
</select>
</mapper>
......@@ -207,7 +207,7 @@
dt,
dir,
sum(event_number)AS event_number ,
DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time ,
to_char(t1.window_start_time,'HH24:MI') AS hours_window_start_time ,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_green_hour t1
......@@ -224,7 +224,7 @@
and t1.event_type = #{eventType}
</if>
GROUP BY
DATE_FORMAT(t1.window_start_time,'%H:%i')
to_char(t1.window_start_time,'HH24:MI')
ORDER BY event_number desc
limit 2
</select>
......
......@@ -5,15 +5,28 @@
SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_schedules_plan as a LEFT JOIN t_base_cross_section as b on a.plan_id = b.plan_id LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where a.cross_id = #{crossId} and a.week = #{weekNumber} ORDER BY start_time
</select>
<!-- <select id="getSpecialDate" resultType="java.util.Map">-->
<!-- SELECT DATE_FORMAT(special_date, '%Y-%m-%d %H:%i:%s') AS special_date, plan_id-->
<!-- FROM t_base_cross_schedules_plan-->
<!-- WHERE cross_id = #{crossId}-->
<!-- <if test="endTime != null and endTime != '' and startTime != null and startTime !='' ">-->
<!-- and special_date between #{startTime} and #{endTime}-->
<!-- </if>-->
<!-- AND week = 0-->
<!-- </select>-->
<select id="getSpecialDate" resultType="java.util.Map">
SELECT DATE_FORMAT(special_date, '%Y-%m-%d %H:%i:%s') AS special_date, plan_id
SELECT
to_char(special_date, 'YYYY-MM-DD HH24:MI:SS') AS special_date,
plan_id
FROM t_base_cross_schedules_plan
WHERE cross_id = #{crossId}
<if test="endTime != null and endTime != '' and startTime != null and startTime !='' ">
and special_date between #{startTime} and #{endTime}
</if>
AND week = 0
<if test="endTime != null and endTime != '' and startTime != null and startTime !=''">
AND special_date BETWEEN #{startTime}::timestamp AND #{endTime}::timestamp
</if>
AND week = 0
</select>
<select id="getSpecialByDateScope" resultType="java.util.Map">
SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_section as b LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where b.cross_id = #{crossId} and b.plan_id = #{planId} ORDER BY start_time
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment