Commit a95e90da authored by duanruiming's avatar duanruiming

[add] 添加绿波实时和历史表插入语法

parent 5d9c6328
...@@ -2,6 +2,7 @@ package net.wanji.databus.dao.mapper; ...@@ -2,6 +2,7 @@ package net.wanji.databus.dao.mapper;
import net.wanji.databus.dao.entity.GreenwaveHistPO; import net.wanji.databus.dao.entity.GreenwaveHistPO;
import net.wanji.databus.dao.entity.GreenwaveHistPOExt; import net.wanji.databus.dao.entity.GreenwaveHistPOExt;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Date; import java.util.Date;
...@@ -18,4 +19,6 @@ public interface GreenwaveHistMapper { ...@@ -18,4 +19,6 @@ public interface GreenwaveHistMapper {
List<GreenwaveHistPO> selectByTimeSection(String startTimeStr, String endTimeStr); List<GreenwaveHistPO> selectByTimeSection(String startTimeStr, String endTimeStr);
List<GreenwaveHistPO> selectByIdAndTimeSection(Integer greenwaveId, String startTimeStr, String endTimeStr); List<GreenwaveHistPO> selectByIdAndTimeSection(Integer greenwaveId, String startTimeStr, String endTimeStr);
int insertBatch(@Param("list") List<GreenwaveHistPO> list);
} }
package net.wanji.databus.dao.mapper; package net.wanji.databus.dao.mapper;
import feign.Param;
import net.wanji.databus.dao.entity.GreenwaveRealtimePO; import net.wanji.databus.dao.entity.GreenwaveRealtimePO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* @author Kent HAN * @author Kent HAN
* @date 2022/10/31 11:03 * @date 2022/10/31 11:03
...@@ -10,4 +13,6 @@ import org.springframework.stereotype.Repository; ...@@ -10,4 +13,6 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface GreenwaveRealtimeMapper { public interface GreenwaveRealtimeMapper {
GreenwaveRealtimePO selectById(Integer id); GreenwaveRealtimePO selectById(Integer id);
int insertBatch(@Param("list") List<GreenwaveRealtimePO> list);
} }
...@@ -41,4 +41,16 @@ ...@@ -41,4 +41,16 @@
and gmt_modified <![CDATA[ >= ]]> #{startTimeStr} and gmt_modified <![CDATA[ >= ]]> #{startTimeStr}
</select> </select>
<insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveHistPO">
insert into t_greenwave_realtime
<include refid="baseColumnList"></include>
values
<foreach collection="list" item="entity" separator="," open="(" close=")">
(#{entity.id}, #{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed},
#{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate},
#{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio},
#{entity.uncoordinatePhaseQueue})
</foreach>
</insert>
</mapper> </mapper>
...@@ -8,9 +8,22 @@ ...@@ -8,9 +8,22 @@
</sql> </sql>
<select id="selectById" resultType="net.wanji.databus.dao.entity.GreenwaveRealtimePO"> <select id="selectById" resultType="net.wanji.databus.dao.entity.GreenwaveRealtimePO">
select <include refid="baseColumnList"/> select
<include refid="baseColumnList"/>
from t_greenwave_realtime from t_greenwave_realtime
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertBatch" parameterType="net.wanji.databus.dao.entity.GreenwaveRealtimePO">
insert into t_greenwave_realtime
<include refid="baseColumnList"></include>
values
<foreach collection="list" item="entity" separator="," open="(" close=")">
(#{entity.id}, #{entity.status}, #{entity.type}, #{entity.trafficIndex},#{entity.speed},
#{entity.trvalTime}, #{entity.stopTimes}, #{entity.queueLength}, #{entity.congRate},
#{entity.delayTime}, #{entity.noparkPassRate}, #{entity.cordReliability}, #{entity.cordQueueRatio},
#{entity.uncoordinatePhaseQueue})
</foreach>
</insert>
</mapper> </mapper>
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