Commit 2a945f39 authored by wangtao's avatar wangtao

交通事件信息 增加根据条件查询数据 以及相关基础代码生成

parent eecedc55
package net.wanji.opt.controllerv2.evaluation;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.rest.impl.AbstractRestServerImpl;
import net.wanji.opt.servicev2.evaluation.EventInfoService;
import net.wanji.opt.entity.evaluation.EventInfo;
import net.wanji.common.framework.rest.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiImplicitParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 交通事件信息 接口API
* </p>
* @version 1.0
* @author wangtao
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/event-info")
@Api(value="EventInfoController", description="交通事件信息接口", tags = "交通事件信息")
public class EventInfoController extends AbstractRestServerImpl<EventInfo> implements AbstractRestServer<EventInfo>{
@Autowired
private EventInfoService eventInfoService;
@Override
public EventInfoService getBaseDubboInterface() {
return this.eventInfoService;
}
/**
* 获取所有交通事件信息记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-获取所有记录", notes = "获取所有交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getAll() {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
List<EventInfo> list = this.getBaseDubboInterface().findAll();
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "交通事件信息-根据开始以及结束时间查询交通事件信息", notes = "获取所有交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", required = true, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", required = true, dataType = "String"),
@ApiImplicitParam(name = "crossId", value = "路口id", required = true, dataType = "String"),
})
@GetMapping(value = "getListByStartAndEnd")
public JsonViewObject getListByStartAndEnd(String startTime, String endTime, String crossId){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
Map<String, Object> map = new HashMap<>();
map.put("startTime",startTime);
map.put("endTime",endTime);
map.put("crossId",crossId);
try {
List<EventInfo> list = this.getBaseDubboInterface().getListByStartAndEnd(map);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据id查询交通事件信息记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-根据id查询记录", notes = "根据id查询交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getById(@PathVariable String id) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
EventInfo entity = this.getBaseDubboInterface().findById(id);
jsonView.success(entity);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
@ApiOperation(value = "交通事件信息-根据条件查询记录", notes = "根据条件查询记录", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getByWhere(@RequestBody EventInfo entity) {
return super.getByWhere(entity);
}
@ApiOperation(value = "交通事件信息-根据条件分页查询记录", notes = "根据条件分页查询记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/byPage", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ResponseBody
public JsonViewObject getPage(@RequestBody Page<EventInfo> page){
return super.getPage(page);
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON ,hidden = true)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
public JsonViewObject deleteByIds(String ids) {
return super.deleteByIds(ids);
}
/**
* 新建记录
*
* @param entity
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject save( @RequestBody EventInfo entity){
return super.save(entity);
}
/**
* 修改记录
*
* @param entity
* @return
*/
@ApiOperation(value = "交通事件信息-修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject update(@RequestBody EventInfo entity){
return super.update(entity);
}
}
package net.wanji.opt.dao.mapper.evaluation;
import net.wanji.opt.entity.evaluation.EventInfo;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
/**
* <p>
* 交通事件信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
public interface EventInfoMapper extends BaseInterfaceMapper<EventInfo> {
List<EventInfo> getListByStartAndEnd(Map<String, Object> map);
}
package net.wanji.opt.entity.evaluation;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.wanji.common.framework.domain.TrackableEntity;
import java.util.Date;
import java.math.BigDecimal;
/**
* <p>
* 交通事件信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
@Data
@ApiModel(value="EventInfo对象", description="交通事件信息")
public class EventInfo extends TrackableEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Long oid;
@ApiModelProperty(value = "车牌号")
private String plateNo;
@ApiModelProperty(value = "参与者类别 1:机动车 2:非机动车 3:行人")
private String objectType;
@ApiModelProperty(value = "可信度")
private Integer confidence;
@ApiModelProperty(value = "检测时间")
private Date detectTime;
@ApiModelProperty(value = "事件等级:1扣分 2 罚款 3警告 0 未知")
private Integer grade;
@ApiModelProperty(value = "事件地点描述")
private String placeDesc;
@ApiModelProperty(value = "发生地点经度")
private BigDecimal lng;
@ApiModelProperty(value = "发生地点纬度")
private BigDecimal lat;
@ApiModelProperty(value = "事件一级类别 事件一级类别 1:机动车事件 2:非机动车事件 3:行人事件")
private String category;
@ApiModelProperty(value = "二级类别")
private String type;
@ApiModelProperty(value = "事件发生时间")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
private Date startTime;
@ApiModelProperty(value = "事件结束时间")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
private Date endTime;
@ApiModelProperty(value = "事件持续时长,单位秒")
private Integer duration;
@ApiModelProperty(value = "事件来源 1:系统检测 2:接处警 3:互联网 4:交管部门 5:大脑")
private String source;
@ApiModelProperty(value = "入库时间")
private Date ruksj;
@ApiModelProperty(value = "车道id")
private String laneId;
@ApiModelProperty(value = "路段id")
private String rid;
@ApiModelProperty(value = "渠化id")
private String segmentId;
@ApiModelProperty(value = "路口id")
private String crossId;
@ApiModelProperty(value = "路口所属绿波编号")
private String greenId;
@ApiModelProperty(value = "关联的事件摄像头信息ID")
private Long cameraOid;
@ApiModelProperty(value = "事件序列号作为主键")
private String eventSerialNumber;
private String dataStatus;
@ApiModelProperty(value = "目标id")
private String globalId;
private Integer stationId;
private String eventId;
@ApiModelProperty(value = "备注")
private String remark;
private String extend;
@ApiModelProperty(value = "分区字段")
private Integer dt;
@ApiModelProperty(value = "视频地址")
private String videoUrls;
@ApiModelProperty(value = "目标具体类型")
private Integer targetType;
@ApiModelProperty(value = "告警状态 0未处理 1分析中 2优化中 3优化完 4已结束")
private Integer alarmStatus;
@ApiModelProperty(value = "优化状态 0 未优化 1-优化过 根据上面告警状态如果有2 3状态认为优化过 ")
private Integer optStatus;
@ApiModelProperty(value = "修改时间")
private Date modifyTime;
@ApiModelProperty(value = "方向 1北...8西北")
private String dir;
@ApiModelProperty(value = "事件转向")
private String turn;
@ApiModelProperty(value = "失衡指数1-10")
private Double unbalanceIndex;
@ApiModelProperty(value = "溢出指数1-10 溢出程度的刻画(没溢出:1,即将溢出:3,溢出:5,溢停:7)")
private Double spilloverIndex;
@ApiModelProperty(value = "交通指数")
private Double trafficIndex;
/*****非数据库字段*******/
private String typeName;
//用于存放日期差-分钟
private String diffTime;
}
<?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="net.wanji.opt.dao.mapper.evaluation.EventInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="net.wanji.opt.entity.evaluation.EventInfo">
<id column="start_time" property="startTime" />
<result column="oid" property="oid" />
<result column="plate_no" property="plateNo" />
<result column="object_type" property="objectType" />
<result column="confidence" property="confidence" />
<result column="detect_time" property="detectTime" />
<result column="grade" property="grade" />
<result column="place_desc" property="placeDesc" />
<result column="lng" property="lng" />
<result column="lat" property="lat" />
<result column="category" property="category" />
<result column="type" property="type" />
<result column="end_time" property="endTime" />
<result column="duration" property="duration" />
<result column="source" property="source" />
<result column="ruksj" property="ruksj" />
<result column="lane_id" property="laneId" />
<result column="rid" property="rid" />
<result column="segment_id" property="segmentId" />
<result column="cross_id" property="crossId" />
<result column="green_id" property="greenId" />
<result column="camera_oid" property="cameraOid" />
<result column="event_serial_number" property="eventSerialNumber" />
<result column="data_status" property="dataStatus" />
<result column="global_id" property="globalId" />
<result column="station_id" property="stationId" />
<result column="event_id" property="eventId" />
<result column="remark" property="remark" />
<result column="extend" property="extend" />
<result column="dt" property="dt" />
<result column="video_urls" property="videoUrls" />
<result column="target_type" property="targetType" />
<result column="alarm_status" property="alarmStatus" />
<result column="opt_status" property="optStatus" />
<result column="modify_time" property="modifyTime" />
<result column="dir" property="dir" />
<result column="turn" property="turn" />
<result column="unbalance_index" property="unbalanceIndex" />
<result column="spillover_index" property="spilloverIndex" />
<result column="traffic_index" property="trafficIndex" />
</resultMap>
<sql id="Table_Name">
t_event_info
</sql>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
oid, plate_no, object_type, confidence, detect_time, grade, place_desc, lng, lat, category, type, start_time, end_time, duration, source, ruksj, lane_id, rid, segment_id, cross_id, green_id, camera_oid, event_serial_number, data_status, global_id, station_id, event_id, remark, extend, dt, video_urls, target_type, alarm_status, opt_status, modify_time, dir, turn, unbalance_index, spillover_index, traffic_index
</sql>
<!--新增操作 -->
<insert id="save" parameterType="net.wanji.opt.entity.evaluation.EventInfo">
insert into
<include refid="Table_Name"/>
(<include refid="Base_Column_List"/>)
values(
#{oid}
,#{plateNo}
,#{objectType}
,#{confidence}
,#{detectTime}
,#{grade}
,#{placeDesc}
,#{lng}
,#{lat}
,#{category}
,#{type}
,#{startTime}
,#{endTime}
,#{duration}
,#{source}
,#{ruksj}
,#{laneId}
,#{rid}
,#{segmentId}
,#{crossId}
,#{greenId}
,#{cameraOid}
,#{eventSerialNumber}
,#{dataStatus}
,#{globalId}
,#{stationId}
,#{eventId}
,#{remark}
,#{extend}
,#{dt}
,#{videoUrls}
,#{targetType}
,#{alarmStatus}
,#{optStatus}
,#{modifyTime}
,#{dir}
,#{turn}
,#{unbalanceIndex}
,#{spilloverIndex}
,#{trafficIndex}
)
</insert>
<!--根据ID查询-->
<select id="findById" resultMap="BaseResultMap" parameterType="String">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
where id = #{id}
</select>
<!--获取数据总数-->
<select id="getCount" parameterType="java.util.Map" resultType="int">
select count(*) from
<include refid="Table_Name"/>
where 1=1
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</select>
<!-- 查询所有数据-->
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!-- 通过条件查询所有数据-->
<select id="findByMap" parameterType="java.util.Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!--分组分页查询-->
<select id="findByPage" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
limit #{startRowNum}, #{pageSize}
</select>
<!--更新-->
<update id="update" parameterType="net.wanji.opt.entity.evaluation.EventInfo">
update
<include refid="Table_Name"/>
<include refid="sql_update"/>
where
start_time = #{startTime}
</update>
<!--根据ID删除-->
<delete id="deleteById" parameterType="String">
delete from
<include refid="Table_Name"/>
where
start_time = #{startTime}
</delete>
<sql id="fuzzySearch">
<if test="keyword != null and keyword !=''">
and (locate(#{keyword,jdbcType=VARCHAR}, s_name)>0
)
</if>
</sql>
<sql id="sql_query">
<if test="oid != null and oid != '' ">
<![CDATA[ and oid = #{oid}]]>
</if>
<if test="plateNo != null and plateNo != '' ">
<![CDATA[ and plate_no = #{plateNo}]]>
</if>
<if test="objectType != null and objectType != '' ">
<![CDATA[ and object_type = #{objectType}]]>
</if>
<if test="confidence != null and confidence != '' ">
<![CDATA[ and confidence = #{confidence}]]>
</if>
<if test="detectTime != null and detectTime != '' ">
<![CDATA[ and detect_time = #{detectTime}]]>
</if>
<if test="grade != null and grade != '' ">
<![CDATA[ and grade = #{grade}]]>
</if>
<if test="placeDesc != null and placeDesc != '' ">
<![CDATA[ and place_desc = #{placeDesc}]]>
</if>
<if test="lng != null and lng != '' ">
<![CDATA[ and lng = #{lng}]]>
</if>
<if test="lat != null and lat != '' ">
<![CDATA[ and lat = #{lat}]]>
</if>
<if test="category != null and category != '' ">
<![CDATA[ and category = #{category}]]>
</if>
<if test="type != null and type != '' ">
<![CDATA[ and type = #{type}]]>
</if>
<if test="startTime != null and startTime != '' ">
<![CDATA[ and start_time = #{startTime}]]>
</if>
<if test="endTime != null and endTime != '' ">
<![CDATA[ and end_time = #{endTime}]]>
</if>
<if test="duration != null and duration != '' ">
<![CDATA[ and duration = #{duration}]]>
</if>
<if test="source != null and source != '' ">
<![CDATA[ and source = #{source}]]>
</if>
<if test="ruksj != null and ruksj != '' ">
<![CDATA[ and ruksj = #{ruksj}]]>
</if>
<if test="laneId != null and laneId != '' ">
<![CDATA[ and lane_id = #{laneId}]]>
</if>
<if test="rid != null and rid != '' ">
<![CDATA[ and rid = #{rid}]]>
</if>
<if test="segmentId != null and segmentId != '' ">
<![CDATA[ and segment_id = #{segmentId}]]>
</if>
<if test="crossId != null and crossId != '' ">
<![CDATA[ and cross_id = #{crossId}]]>
</if>
<if test="greenId != null and greenId != '' ">
<![CDATA[ and green_id = #{greenId}]]>
</if>
<if test="cameraOid != null and cameraOid != '' ">
<![CDATA[ and camera_oid = #{cameraOid}]]>
</if>
<if test="eventSerialNumber != null and eventSerialNumber != '' ">
<![CDATA[ and event_serial_number = #{eventSerialNumber}]]>
</if>
<if test="dataStatus != null and dataStatus != '' ">
<![CDATA[ and data_status = #{dataStatus}]]>
</if>
<if test="globalId != null and globalId != '' ">
<![CDATA[ and global_id = #{globalId}]]>
</if>
<if test="stationId != null and stationId != '' ">
<![CDATA[ and station_id = #{stationId}]]>
</if>
<if test="eventId != null and eventId != '' ">
<![CDATA[ and event_id = #{eventId}]]>
</if>
<if test="remark != null and remark != '' ">
<![CDATA[ and remark = #{remark}]]>
</if>
<if test="extend != null and extend != '' ">
<![CDATA[ and extend = #{extend}]]>
</if>
<if test="dt != null and dt != '' ">
<![CDATA[ and dt = #{dt}]]>
</if>
<if test="videoUrls != null and videoUrls != '' ">
<![CDATA[ and video_urls = #{videoUrls}]]>
</if>
<if test="targetType != null and targetType != '' ">
<![CDATA[ and target_type = #{targetType}]]>
</if>
<if test="alarmStatus != null and alarmStatus != '' ">
<![CDATA[ and alarm_status = #{alarmStatus}]]>
</if>
<if test="optStatus != null and optStatus != '' ">
<![CDATA[ and opt_status = #{optStatus}]]>
</if>
<if test="modifyTime != null and modifyTime != '' ">
<![CDATA[ and modify_time = #{modifyTime}]]>
</if>
<if test="dir != null and dir != '' ">
<![CDATA[ and dir = #{dir}]]>
</if>
<if test="turn != null and turn != '' ">
<![CDATA[ and turn = #{turn}]]>
</if>
<if test="unbalanceIndex != null and unbalanceIndex != '' ">
<![CDATA[ and unbalance_index = #{unbalanceIndex}]]>
</if>
<if test="spilloverIndex != null and spilloverIndex != '' ">
<![CDATA[ and spillover_index = #{spilloverIndex}]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ and traffic_index = #{trafficIndex}]]>
</if>
</sql>
<!--更新操作-->
<sql id="sql_update">
<set>
<if test="oid != null and oid != '' ">
<![CDATA[ oid = #{oid}, ]]>
</if>
<if test="plateNo != null and plateNo != '' ">
<![CDATA[ plate_no = #{plateNo}, ]]>
</if>
<if test="objectType != null and objectType != '' ">
<![CDATA[ object_type = #{objectType}, ]]>
</if>
<if test="confidence != null and confidence != '' ">
<![CDATA[ confidence = #{confidence}, ]]>
</if>
<if test="detectTime != null and detectTime != '' ">
<![CDATA[ detect_time = #{detectTime}, ]]>
</if>
<if test="grade != null and grade != '' ">
<![CDATA[ grade = #{grade}, ]]>
</if>
<if test="placeDesc != null and placeDesc != '' ">
<![CDATA[ place_desc = #{placeDesc}, ]]>
</if>
<if test="lng != null and lng != '' ">
<![CDATA[ lng = #{lng}, ]]>
</if>
<if test="lat != null and lat != '' ">
<![CDATA[ lat = #{lat}, ]]>
</if>
<if test="category != null and category != '' ">
<![CDATA[ category = #{category}, ]]>
</if>
<if test="type != null and type != '' ">
<![CDATA[ type = #{type}, ]]>
</if>
<if test="startTime != null and startTime != '' ">
<![CDATA[ start_time = #{startTime}, ]]>
</if>
<if test="endTime != null and endTime != '' ">
<![CDATA[ end_time = #{endTime}, ]]>
</if>
<if test="duration != null and duration != '' ">
<![CDATA[ duration = #{duration}, ]]>
</if>
<if test="source != null and source != '' ">
<![CDATA[ source = #{source}, ]]>
</if>
<if test="ruksj != null and ruksj != '' ">
<![CDATA[ ruksj = #{ruksj}, ]]>
</if>
<if test="laneId != null and laneId != '' ">
<![CDATA[ lane_id = #{laneId}, ]]>
</if>
<if test="rid != null and rid != '' ">
<![CDATA[ rid = #{rid}, ]]>
</if>
<if test="segmentId != null and segmentId != '' ">
<![CDATA[ segment_id = #{segmentId}, ]]>
</if>
<if test="crossId != null and crossId != '' ">
<![CDATA[ cross_id = #{crossId}, ]]>
</if>
<if test="greenId != null and greenId != '' ">
<![CDATA[ green_id = #{greenId}, ]]>
</if>
<if test="cameraOid != null and cameraOid != '' ">
<![CDATA[ camera_oid = #{cameraOid}, ]]>
</if>
<if test="eventSerialNumber != null and eventSerialNumber != '' ">
<![CDATA[ event_serial_number = #{eventSerialNumber}, ]]>
</if>
<if test="dataStatus != null and dataStatus != '' ">
<![CDATA[ data_status = #{dataStatus}, ]]>
</if>
<if test="globalId != null and globalId != '' ">
<![CDATA[ global_id = #{globalId}, ]]>
</if>
<if test="stationId != null and stationId != '' ">
<![CDATA[ station_id = #{stationId}, ]]>
</if>
<if test="eventId != null and eventId != '' ">
<![CDATA[ event_id = #{eventId}, ]]>
</if>
<if test="remark != null and remark != '' ">
<![CDATA[ remark = #{remark}, ]]>
</if>
<if test="extend != null and extend != '' ">
<![CDATA[ extend = #{extend}, ]]>
</if>
<if test="dt != null and dt != '' ">
<![CDATA[ dt = #{dt}, ]]>
</if>
<if test="videoUrls != null and videoUrls != '' ">
<![CDATA[ video_urls = #{videoUrls}, ]]>
</if>
<if test="targetType != null and targetType != '' ">
<![CDATA[ target_type = #{targetType}, ]]>
</if>
<if test="alarmStatus != null and alarmStatus != '' ">
<![CDATA[ alarm_status = #{alarmStatus}, ]]>
</if>
<if test="optStatus != null and optStatus != '' ">
<![CDATA[ opt_status = #{optStatus}, ]]>
</if>
<if test="modifyTime != null and modifyTime != '' ">
<![CDATA[ modify_time = #{modifyTime}, ]]>
</if>
<if test="dir != null and dir != '' ">
<![CDATA[ dir = #{dir}, ]]>
</if>
<if test="turn != null and turn != '' ">
<![CDATA[ turn = #{turn}, ]]>
</if>
<if test="unbalanceIndex != null and unbalanceIndex != '' ">
<![CDATA[ unbalance_index = #{unbalanceIndex}, ]]>
</if>
<if test="spilloverIndex != null and spilloverIndex != '' ">
<![CDATA[ spillover_index = #{spilloverIndex}, ]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ traffic_index = #{trafficIndex}, ]]>
</if>
</set>
</sql>
</mapper>
package net.wanji.opt.servicev2.evaluation;
import net.wanji.opt.entity.evaluation.EventInfo;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import java.util.List;
import java.util.Map;
/**
* <p>
* 交通事件信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
public interface EventInfoService extends BaseDubboInterface<EventInfo> {
List<EventInfo> getListByStartAndEnd(Map<String, Object> map);
}
package net.wanji.opt.servicev2.evaluation.impl;
import net.wanji.common.framework.dubbointerface.impl.BaseDubboInterfaceImpl;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.evaluation.EventInfo;
import net.wanji.opt.servicev2.evaluation.EventInfoService;
import net.wanji.opt.dao.mapper.evaluation.EventInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* <p>
* 交通事件信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
@Slf4j
@Component
@Service
public class EventInfoServiceImpl extends BaseDubboInterfaceImpl<EventInfo> implements EventInfoService {
@Resource
private EventInfoMapper eventInfoMapper;
@Override
public BaseInterfaceMapper<EventInfo> getBaseInterfaceMapper() {
return this.eventInfoMapper;
}
public List<EventInfo> getListByStartAndEnd(Map<String, Object> map){
return this.eventInfoMapper.getListByStartAndEnd(map);
}
}
<?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="net.wanji.opt.dao.mapper.evaluation.EventInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="net.wanji.opt.entity.evaluation.EventInfo">
<id column="start_time" property="startTime" />
<result column="oid" property="oid" />
<result column="plate_no" property="plateNo" />
<result column="object_type" property="objectType" />
<result column="confidence" property="confidence" />
<result column="detect_time" property="detectTime" />
<result column="grade" property="grade" />
<result column="place_desc" property="placeDesc" />
<result column="lng" property="lng" />
<result column="lat" property="lat" />
<result column="category" property="category" />
<result column="type" property="type" />
<result column="end_time" property="endTime" />
<result column="duration" property="duration" />
<result column="source" property="source" />
<result column="ruksj" property="ruksj" />
<result column="lane_id" property="laneId" />
<result column="rid" property="rid" />
<result column="segment_id" property="segmentId" />
<result column="cross_id" property="crossId" />
<result column="green_id" property="greenId" />
<result column="camera_oid" property="cameraOid" />
<result column="event_serial_number" property="eventSerialNumber" />
<result column="data_status" property="dataStatus" />
<result column="global_id" property="globalId" />
<result column="station_id" property="stationId" />
<result column="event_id" property="eventId" />
<result column="remark" property="remark" />
<result column="extend" property="extend" />
<result column="dt" property="dt" />
<result column="video_urls" property="videoUrls" />
<result column="target_type" property="targetType" />
<result column="alarm_status" property="alarmStatus" />
<result column="opt_status" property="optStatus" />
<result column="modify_time" property="modifyTime" />
<result column="dir" property="dir" />
<result column="turn" property="turn" />
<result column="unbalance_index" property="unbalanceIndex" />
<result column="spillover_index" property="spilloverIndex" />
<result column="traffic_index" property="trafficIndex" />
</resultMap>
<sql id="Table_Name">
t_event_info
</sql>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
oid, plate_no, object_type, confidence, detect_time, grade, place_desc, lng, lat, category, type, start_time, end_time, duration, source, ruksj, lane_id, rid, segment_id, cross_id, green_id, camera_oid, event_serial_number, data_status, global_id, station_id, event_id, remark, extend, dt, video_urls, target_type, alarm_status, opt_status, modify_time, dir, turn, unbalance_index, spillover_index, traffic_index
</sql>
<!--新增操作 -->
<insert id="save" parameterType="net.wanji.opt.entity.evaluation.EventInfo">
insert into
<include refid="Table_Name"/>
(<include refid="Base_Column_List"/>)
values(
#{oid}
,#{plateNo}
,#{objectType}
,#{confidence}
,#{detectTime}
,#{grade}
,#{placeDesc}
,#{lng}
,#{lat}
,#{category}
,#{type}
,#{startTime}
,#{endTime}
,#{duration}
,#{source}
,#{ruksj}
,#{laneId}
,#{rid}
,#{segmentId}
,#{crossId}
,#{greenId}
,#{cameraOid}
,#{eventSerialNumber}
,#{dataStatus}
,#{globalId}
,#{stationId}
,#{eventId}
,#{remark}
,#{extend}
,#{dt}
,#{videoUrls}
,#{targetType}
,#{alarmStatus}
,#{optStatus}
,#{modifyTime}
,#{dir}
,#{turn}
,#{unbalanceIndex}
,#{spilloverIndex}
,#{trafficIndex}
)
</insert>
<!--根据ID查询-->
<select id="findById" resultMap="BaseResultMap" parameterType="String">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
where id = #{id}
</select>
<!--获取数据总数-->
<select id="getCount" parameterType="java.util.Map" resultType="int">
select count(*) from
<include refid="Table_Name"/>
where 1=1
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</select>
<!-- 查询所有数据-->
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!-- 通过条件查询所有数据-->
<select id="findByMap" parameterType="java.util.Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!--分组分页查询-->
<select id="findByPage" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
limit #{startRowNum}, #{pageSize}
</select>
<!--更新-->
<update id="update" parameterType="net.wanji.opt.entity.evaluation.EventInfo">
update
<include refid="Table_Name"/>
<include refid="sql_update"/>
where
start_time = #{startTime}
</update>
<!--根据ID删除-->
<delete id="deleteById" parameterType="String">
delete from
<include refid="Table_Name"/>
where
start_time = #{startTime}
</delete>
<sql id="fuzzySearch">
<if test="keyword != null and keyword !=''">
and (locate(#{keyword,jdbcType=VARCHAR}, s_name)>0
)
</if>
</sql>
<sql id="sql_query">
<if test="oid != null and oid != '' ">
<![CDATA[ and oid = #{oid}]]>
</if>
<if test="plateNo != null and plateNo != '' ">
<![CDATA[ and plate_no = #{plateNo}]]>
</if>
<if test="objectType != null and objectType != '' ">
<![CDATA[ and object_type = #{objectType}]]>
</if>
<if test="confidence != null and confidence != '' ">
<![CDATA[ and confidence = #{confidence}]]>
</if>
<if test="detectTime != null and detectTime != '' ">
<![CDATA[ and detect_time = #{detectTime}]]>
</if>
<if test="grade != null and grade != '' ">
<![CDATA[ and grade = #{grade}]]>
</if>
<if test="placeDesc != null and placeDesc != '' ">
<![CDATA[ and place_desc = #{placeDesc}]]>
</if>
<if test="lng != null and lng != '' ">
<![CDATA[ and lng = #{lng}]]>
</if>
<if test="lat != null and lat != '' ">
<![CDATA[ and lat = #{lat}]]>
</if>
<if test="category != null and category != '' ">
<![CDATA[ and category = #{category}]]>
</if>
<if test="type != null and type != '' ">
<![CDATA[ and type = #{type}]]>
</if>
<if test="startTime != null and startTime != '' ">
<![CDATA[ and start_time = #{startTime}]]>
</if>
<if test="endTime != null and endTime != '' ">
<![CDATA[ and end_time = #{endTime}]]>
</if>
<if test="duration != null and duration != '' ">
<![CDATA[ and duration = #{duration}]]>
</if>
<if test="source != null and source != '' ">
<![CDATA[ and source = #{source}]]>
</if>
<if test="ruksj != null and ruksj != '' ">
<![CDATA[ and ruksj = #{ruksj}]]>
</if>
<if test="laneId != null and laneId != '' ">
<![CDATA[ and lane_id = #{laneId}]]>
</if>
<if test="rid != null and rid != '' ">
<![CDATA[ and rid = #{rid}]]>
</if>
<if test="segmentId != null and segmentId != '' ">
<![CDATA[ and segment_id = #{segmentId}]]>
</if>
<if test="crossId != null and crossId != '' ">
<![CDATA[ and cross_id = #{crossId}]]>
</if>
<if test="greenId != null and greenId != '' ">
<![CDATA[ and green_id = #{greenId}]]>
</if>
<if test="cameraOid != null and cameraOid != '' ">
<![CDATA[ and camera_oid = #{cameraOid}]]>
</if>
<if test="eventSerialNumber != null and eventSerialNumber != '' ">
<![CDATA[ and event_serial_number = #{eventSerialNumber}]]>
</if>
<if test="dataStatus != null and dataStatus != '' ">
<![CDATA[ and data_status = #{dataStatus}]]>
</if>
<if test="globalId != null and globalId != '' ">
<![CDATA[ and global_id = #{globalId}]]>
</if>
<if test="stationId != null and stationId != '' ">
<![CDATA[ and station_id = #{stationId}]]>
</if>
<if test="eventId != null and eventId != '' ">
<![CDATA[ and event_id = #{eventId}]]>
</if>
<if test="remark != null and remark != '' ">
<![CDATA[ and remark = #{remark}]]>
</if>
<if test="extend != null and extend != '' ">
<![CDATA[ and extend = #{extend}]]>
</if>
<if test="dt != null and dt != '' ">
<![CDATA[ and dt = #{dt}]]>
</if>
<if test="videoUrls != null and videoUrls != '' ">
<![CDATA[ and video_urls = #{videoUrls}]]>
</if>
<if test="targetType != null and targetType != '' ">
<![CDATA[ and target_type = #{targetType}]]>
</if>
<if test="alarmStatus != null and alarmStatus != '' ">
<![CDATA[ and alarm_status = #{alarmStatus}]]>
</if>
<if test="optStatus != null and optStatus != '' ">
<![CDATA[ and opt_status = #{optStatus}]]>
</if>
<if test="modifyTime != null and modifyTime != '' ">
<![CDATA[ and modify_time = #{modifyTime}]]>
</if>
<if test="dir != null and dir != '' ">
<![CDATA[ and dir = #{dir}]]>
</if>
<if test="turn != null and turn != '' ">
<![CDATA[ and turn = #{turn}]]>
</if>
<if test="unbalanceIndex != null and unbalanceIndex != '' ">
<![CDATA[ and unbalance_index = #{unbalanceIndex}]]>
</if>
<if test="spilloverIndex != null and spilloverIndex != '' ">
<![CDATA[ and spillover_index = #{spilloverIndex}]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ and traffic_index = #{trafficIndex}]]>
</if>
</sql>
<!--更新操作-->
<sql id="sql_update">
<set>
<if test="oid != null and oid != '' ">
<![CDATA[ oid = #{oid}, ]]>
</if>
<if test="plateNo != null and plateNo != '' ">
<![CDATA[ plate_no = #{plateNo}, ]]>
</if>
<if test="objectType != null and objectType != '' ">
<![CDATA[ object_type = #{objectType}, ]]>
</if>
<if test="confidence != null and confidence != '' ">
<![CDATA[ confidence = #{confidence}, ]]>
</if>
<if test="detectTime != null and detectTime != '' ">
<![CDATA[ detect_time = #{detectTime}, ]]>
</if>
<if test="grade != null and grade != '' ">
<![CDATA[ grade = #{grade}, ]]>
</if>
<if test="placeDesc != null and placeDesc != '' ">
<![CDATA[ place_desc = #{placeDesc}, ]]>
</if>
<if test="lng != null and lng != '' ">
<![CDATA[ lng = #{lng}, ]]>
</if>
<if test="lat != null and lat != '' ">
<![CDATA[ lat = #{lat}, ]]>
</if>
<if test="category != null and category != '' ">
<![CDATA[ category = #{category}, ]]>
</if>
<if test="type != null and type != '' ">
<![CDATA[ type = #{type}, ]]>
</if>
<if test="startTime != null and startTime != '' ">
<![CDATA[ start_time = #{startTime}, ]]>
</if>
<if test="endTime != null and endTime != '' ">
<![CDATA[ end_time = #{endTime}, ]]>
</if>
<if test="duration != null and duration != '' ">
<![CDATA[ duration = #{duration}, ]]>
</if>
<if test="source != null and source != '' ">
<![CDATA[ source = #{source}, ]]>
</if>
<if test="ruksj != null and ruksj != '' ">
<![CDATA[ ruksj = #{ruksj}, ]]>
</if>
<if test="laneId != null and laneId != '' ">
<![CDATA[ lane_id = #{laneId}, ]]>
</if>
<if test="rid != null and rid != '' ">
<![CDATA[ rid = #{rid}, ]]>
</if>
<if test="segmentId != null and segmentId != '' ">
<![CDATA[ segment_id = #{segmentId}, ]]>
</if>
<if test="crossId != null and crossId != '' ">
<![CDATA[ cross_id = #{crossId}, ]]>
</if>
<if test="greenId != null and greenId != '' ">
<![CDATA[ green_id = #{greenId}, ]]>
</if>
<if test="cameraOid != null and cameraOid != '' ">
<![CDATA[ camera_oid = #{cameraOid}, ]]>
</if>
<if test="eventSerialNumber != null and eventSerialNumber != '' ">
<![CDATA[ event_serial_number = #{eventSerialNumber}, ]]>
</if>
<if test="dataStatus != null and dataStatus != '' ">
<![CDATA[ data_status = #{dataStatus}, ]]>
</if>
<if test="globalId != null and globalId != '' ">
<![CDATA[ global_id = #{globalId}, ]]>
</if>
<if test="stationId != null and stationId != '' ">
<![CDATA[ station_id = #{stationId}, ]]>
</if>
<if test="eventId != null and eventId != '' ">
<![CDATA[ event_id = #{eventId}, ]]>
</if>
<if test="remark != null and remark != '' ">
<![CDATA[ remark = #{remark}, ]]>
</if>
<if test="extend != null and extend != '' ">
<![CDATA[ extend = #{extend}, ]]>
</if>
<if test="dt != null and dt != '' ">
<![CDATA[ dt = #{dt}, ]]>
</if>
<if test="videoUrls != null and videoUrls != '' ">
<![CDATA[ video_urls = #{videoUrls}, ]]>
</if>
<if test="targetType != null and targetType != '' ">
<![CDATA[ target_type = #{targetType}, ]]>
</if>
<if test="alarmStatus != null and alarmStatus != '' ">
<![CDATA[ alarm_status = #{alarmStatus}, ]]>
</if>
<if test="optStatus != null and optStatus != '' ">
<![CDATA[ opt_status = #{optStatus}, ]]>
</if>
<if test="modifyTime != null and modifyTime != '' ">
<![CDATA[ modify_time = #{modifyTime}, ]]>
</if>
<if test="dir != null and dir != '' ">
<![CDATA[ dir = #{dir}, ]]>
</if>
<if test="turn != null and turn != '' ">
<![CDATA[ turn = #{turn}, ]]>
</if>
<if test="unbalanceIndex != null and unbalanceIndex != '' ">
<![CDATA[ unbalance_index = #{unbalanceIndex}, ]]>
</if>
<if test="spilloverIndex != null and spilloverIndex != '' ">
<![CDATA[ spillover_index = #{spilloverIndex}, ]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ traffic_index = #{trafficIndex}, ]]>
</if>
</set>
</sql>
<select id="getListByStartAndEnd" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT start_time,
end_time,
ABS(TIMESTAMPDIFF( SECOND, start_time, end_time )) AS diffTime,
info.type,
c.label as typeName
FROM t_event_info info
LEFT JOIN t_config_event_category c ON info.type = c.event_type
WHERE start_time >= #{startTime}
AND #{endTime} >= end_time
AND cross_id = #{crossId}
AND IFNULL(end_time, '') != ''
ORDER BY
start_time DESC
</select>
</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