Commit 793c8e63 authored by hanbing's avatar hanbing

[update] 统一查询全息库SQL格式

parent f84e7bfd
package net.wanji.opt.config;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.Reader;
import java.util.Properties;
@Configuration
public class MyBatisConfig {
@Bean
public SqlSessionFactory sqlSessionFactory() throws Exception {
Properties props = new Properties();
props.setProperty("holodb", "holo_roadnet_jinan"); // 或从某些配置源获取数据库名称
Reader reader = Resources.getResourceAsReader("mybatis-config.xml");
return new SqlSessionFactoryBuilder().build(reader, props);
}
}
......@@ -41,19 +41,21 @@
<select id="selectDirEmergencyCount" resultType="java.lang.Integer">
<choose>
<when test="laneIds != null and laneIds.size() > 0">
(
SELECT COUNT(*)
FROM holo_roadnet_jinan.t_event_info
WHERE type IN ('33', '34', '35', '6')
AND UNIX_TIMESTAMP(start_time) <![CDATA[ >= ]]> #{startTimeStamp}
AND UNIX_TIMESTAMP(start_time) <![CDATA[ <= ]]> #{endTimeStamp}
AND cross_id = #{crossId}
AND lane_id in
AND lane_id IN
<foreach collection="laneIds" item="id" separator="," open="(" close=")">
#{id}
</foreach>
)
</when>
<otherwise>
SELECT 0
0
</otherwise>
</choose>
</select>
......
......@@ -21,19 +21,21 @@
<select id="selectTurnEmergencyCount" resultType="java.lang.Integer">
<choose>
<when test="laneIds != null and laneIds.size() > 0">
(
SELECT COUNT(*)
FROM holo_roadnet_jinan.t_event_info
WHERE type IN ('33', '34', '35', '6')
AND UNIX_TIMESTAMP(start_time) <![CDATA[ >= ]]> #{startTimeStamp}
AND UNIX_TIMESTAMP(start_time) <![CDATA[ <= ]]> #{endTimeStamp}
AND cross_id = #{crossId}
AND lane_id in
AND lane_id IN
<foreach collection="laneIds" item="id" separator="," open="(" close=")">
#{id}
</foreach>
)
</when>
<otherwise>
SELECT 0
0
</otherwise>
</choose>
</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