<?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="com.thhy.screen.modules.biz.agv.mapper.AgvStateHistoryMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.id as id,
|
t.accurate_stop as accurateStop,
|
t.agv_back_laser_swtich as agvBackLaserSwtich,
|
t.agv_base_angular_vel as agvBaseAngularVel,
|
t.agv_base_linear_vel as agvBaseLinearVel,
|
t.agv_collision as agvCollision,
|
t.agv_control_style as agvControlStyle,
|
t.agv_current_landmark_rFID as agvCurrentLandmarkRFID,
|
t.agv_dest_rFID as agvDestRFID,
|
t.agv_emergency_button as agvEmergencyButton,
|
t.agv_front_laser_switch as agvFrontLaserSwitch,
|
t.agv_id as agvId,
|
t.agv_jacking_state as agvJackingState,
|
t.agv_liftup_heavy_state as agvLiftupHeavyState,
|
t.agv_model_rFID as agvModelRFID,
|
t.agv_move_style as agvMoveStyle,
|
t.agv_task_state as agvTaskState,
|
t.agv_vel_direction as agvVelDirection,
|
t.agv_vel_level as agvVelLevel,
|
t.agv_working_state as agvWorkingState,
|
t.battery1_charge as battery1Charge,
|
t.battery1_current as battery1Current,
|
t.battery1_error_code as battery1ErrorCode,
|
t.battery1_voltage as battery1Voltage,
|
t.error_code as errorCode,
|
t.error_content as errorContent,
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
<if test="accurateStop!=null">
|
t.accurate_stop = #{accurateStop} AND
|
</if>
|
<if test="agvBackLaserSwtich!=null">
|
t.agv_back_laser_swtich = #{agvBackLaserSwtich} AND
|
</if>
|
<if test="agvBaseAngularVel!=null">
|
t.agv_base_angular_vel = #{agvBaseAngularVel} AND
|
</if>
|
<if test="agvBaseLinearVel!=null">
|
t.agv_base_linear_vel = #{agvBaseLinearVel} AND
|
</if>
|
<if test="agvCollision!=null">
|
t.agv_collision = #{agvCollision} AND
|
</if>
|
<if test="agvControlStyle!=null and agvControlStyle!=''">
|
t.agv_control_style = #{agvControlStyle} AND
|
</if>
|
<if test="agvCurrentLandmarkRFID!=null">
|
t.agv_current_landmark_rFID = #{agvCurrentLandmarkRFID} AND
|
</if>
|
<if test="agvDestRFID!=null">
|
t.agv_dest_rFID = #{agvDestRFID} AND
|
</if>
|
<if test="agvEmergencyButton!=null">
|
t.agv_emergency_button = #{agvEmergencyButton} AND
|
</if>
|
<if test="agvFrontLaserSwitch!=null">
|
t.agv_front_laser_switch = #{agvFrontLaserSwitch} AND
|
</if>
|
<if test="agvId!=null and agvId!=''">
|
t.agv_id = #{agvId} AND
|
</if>
|
<if test="agvJackingState!=null and agvJackingState!=''">
|
t.agv_jacking_state = #{agvJackingState} AND
|
</if>
|
<if test="agvLiftupHeavyState!=null and agvLiftupHeavyState!=''">
|
t.agv_liftup_heavy_state = #{agvLiftupHeavyState} AND
|
</if>
|
<if test="agvModelRFID!=null">
|
t.agv_model_rFID = #{agvModelRFID} AND
|
</if>
|
<if test="agvMoveStyle!=null and agvMoveStyle!=''">
|
t.agv_move_style = #{agvMoveStyle} AND
|
</if>
|
<if test="agvTaskState!=null and agvTaskState!=''">
|
t.agv_task_state = #{agvTaskState} AND
|
</if>
|
<if test="agvVelDirection!=null and agvVelDirection!=''">
|
t.agv_vel_direction = #{agvVelDirection} AND
|
</if>
|
<if test="agvVelLevel!=null and agvVelLevel!=''">
|
t.agv_vel_level = #{agvVelLevel} AND
|
</if>
|
<if test="agvWorkingState!=null and agvWorkingState!=''">
|
t.agv_working_state = #{agvWorkingState} AND
|
</if>
|
<if test="battery1Charge!=null">
|
t.battery1_charge = #{battery1Charge} AND
|
</if>
|
<if test="battery1Current!=null">
|
t.battery1_current = #{battery1Current} AND
|
</if>
|
<if test="battery1ErrorCode!=null">
|
t.battery1_error_code = #{battery1ErrorCode} AND
|
</if>
|
<if test="battery1Voltage!=null">
|
t.battery1_voltage = #{battery1Voltage} AND
|
</if>
|
<if test="errorCode!=null">
|
t.error_code = #{errorCode} AND
|
</if>
|
<if test="errorContent!=null and errorContent!=''">
|
t.error_content = #{errorContent} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.screen.modules.biz.agv.entity.AgvStateHistory">
|
select <include refid="Base_Column_List" />
|
from t_agv_state_history t
|
where t.id=#{id}
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from t_agv_state_history
|
where id=#{id}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.screen.modules.biz.agv.entity.AgvStateHistory">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_agv_state_history t
|
<include refid="condition_query" />
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.screen.modules.biz.agv.entity.AgvStateHistory">
|
SELECT
|
<include refid="Base_Column_List" />
|
from t_agv_state_history t
|
</select>
|
|
<select id="leastData" resultType="com.thhy.screen.modules.biz.agv.entity.AgvStateHistory">
|
select
|
t.id as id,
|
t.accurate_stop as accurateStop,
|
t.agv_back_laser_swtich as agvBackLaserSwtich,
|
t.agv_base_angular_vel as agvBaseAngularVel,
|
t.agv_base_linear_vel as agvBaseLinearVel,
|
t.agv_collision as agvCollision,
|
t.agv_control_style as agvControlStyle,
|
t.agv_current_landmark_rFID as agvCurrentLandmarkRFID,
|
t.agv_dest_rFID as agvDestRFID,
|
t.agv_emergency_button as agvEmergencyButton,
|
t.agv_front_laser_switch as agvFrontLaserSwitch,
|
t.agv_id as agvId,
|
t.agv_jacking_state as agvJackingState,
|
t.agv_liftup_heavy_state as agvLiftupHeavyState,
|
t.agv_model_rFID as agvModelRFID,
|
t.agv_move_style as agvMoveStyle,
|
t.agv_task_state as agvTaskState,
|
t.agv_vel_direction as agvVelDirection,
|
t.agv_vel_level as agvVelLevel,
|
t.agv_working_state as agvWorkingState,
|
t.battery1_charge as battery1Charge,
|
t.battery1_current as battery1Current,
|
t.battery1_error_code as battery1ErrorCode,
|
t.battery1_voltage as battery1Voltage,
|
t.error_code as errorCode,
|
t.error_content as errorContent
|
FROM
|
(
|
select agv_id,MAX(id) as maxId from t_agv_state_history GROUP BY agv_id
|
) a
|
left join t_agv_state_history t on a.maxId = t.id
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert">
|
insert into t_agv_state_history
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="accurateStop != null">
|
accurate_stop,
|
</if>
|
<if test="agvBackLaserSwtich != null">
|
agv_back_laser_swtich,
|
</if>
|
<if test="agvBaseAngularVel != null">
|
agv_base_angular_vel,
|
</if>
|
<if test="agvBaseLinearVel != null">
|
agv_base_linear_vel,
|
</if>
|
<if test="agvCollision != null">
|
agv_collision,
|
</if>
|
<if test="agvControlStyle != null">
|
agv_control_style,
|
</if>
|
<if test="agvCurrentLandmarkRFID != null">
|
agv_current_landmark_rFID,
|
</if>
|
<if test="agvDestRFID != null">
|
agv_dest_rFID,
|
</if>
|
<if test="agvEmergencyButton != null">
|
agv_emergency_button,
|
</if>
|
<if test="agvFrontLaserSwitch != null">
|
agv_front_laser_switch,
|
</if>
|
<if test="agvId != null">
|
agv_id,
|
</if>
|
<if test="agvJackingState != null">
|
agv_jacking_state,
|
</if>
|
<if test="agvLiftupHeavyState != null">
|
agv_liftup_heavy_state,
|
</if>
|
<if test="agvModelRFID != null">
|
agv_model_rFID,
|
</if>
|
<if test="agvMoveStyle != null">
|
agv_move_style,
|
</if>
|
<if test="agvTaskState != null">
|
agv_task_state,
|
</if>
|
<if test="agvVelDirection != null">
|
agv_vel_direction,
|
</if>
|
<if test="agvVelLevel != null">
|
agv_vel_level,
|
</if>
|
<if test="agvWorkingState != null">
|
agv_working_state,
|
</if>
|
<if test="battery1Charge != null">
|
battery1_charge,
|
</if>
|
<if test="battery1Current != null">
|
battery1_current,
|
</if>
|
<if test="battery1ErrorCode != null">
|
battery1_error_code,
|
</if>
|
<if test="battery1Voltage != null">
|
battery1_voltage,
|
</if>
|
<if test="errorCode != null">
|
error_code,
|
</if>
|
<if test="errorContent != null">
|
error_content,
|
</if>
|
<if test="id != null">
|
id,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="accurateStop != null">
|
#{accurateStop},
|
</if>
|
<if test="agvBackLaserSwtich != null">
|
#{agvBackLaserSwtich},
|
</if>
|
<if test="agvBaseAngularVel != null">
|
#{agvBaseAngularVel},
|
</if>
|
<if test="agvBaseLinearVel != null">
|
#{agvBaseLinearVel},
|
</if>
|
<if test="agvCollision != null">
|
#{agvCollision},
|
</if>
|
<if test="agvControlStyle != null">
|
#{agvControlStyle},
|
</if>
|
<if test="agvCurrentLandmarkRFID != null">
|
#{agvCurrentLandmarkRFID},
|
</if>
|
<if test="agvDestRFID != null">
|
#{agvDestRFID},
|
</if>
|
<if test="agvEmergencyButton != null">
|
#{agvEmergencyButton},
|
</if>
|
<if test="agvFrontLaserSwitch != null">
|
#{agvFrontLaserSwitch},
|
</if>
|
<if test="agvId != null">
|
#{agvId},
|
</if>
|
<if test="agvJackingState != null">
|
#{agvJackingState},
|
</if>
|
<if test="agvLiftupHeavyState != null">
|
#{agvLiftupHeavyState},
|
</if>
|
<if test="agvModelRFID != null">
|
#{agvModelRFID},
|
</if>
|
<if test="agvMoveStyle != null">
|
#{agvMoveStyle},
|
</if>
|
<if test="agvTaskState != null">
|
#{agvTaskState},
|
</if>
|
<if test="agvVelDirection != null">
|
#{agvVelDirection},
|
</if>
|
<if test="agvVelLevel != null">
|
#{agvVelLevel},
|
</if>
|
<if test="agvWorkingState != null">
|
#{agvWorkingState},
|
</if>
|
<if test="battery1Charge != null">
|
#{battery1Charge},
|
</if>
|
<if test="battery1Current != null">
|
#{battery1Current},
|
</if>
|
<if test="battery1ErrorCode != null">
|
#{battery1ErrorCode},
|
</if>
|
<if test="battery1Voltage != null">
|
#{battery1Voltage},
|
</if>
|
<if test="errorCode != null">
|
#{errorCode},
|
</if>
|
<if test="errorContent != null">
|
#{errorContent},
|
</if>
|
<if test="id != null">
|
#{id},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update t_agv_state_history
|
<set>
|
<if test="accurateStop != null">
|
accurate_stop=#{accurateStop},
|
</if>
|
<if test="agvBackLaserSwtich != null">
|
agv_back_laser_swtich=#{agvBackLaserSwtich},
|
</if>
|
<if test="agvBaseAngularVel != null">
|
agv_base_angular_vel=#{agvBaseAngularVel},
|
</if>
|
<if test="agvBaseLinearVel != null">
|
agv_base_linear_vel=#{agvBaseLinearVel},
|
</if>
|
<if test="agvCollision != null">
|
agv_collision=#{agvCollision},
|
</if>
|
<if test="agvControlStyle != null">
|
agv_control_style=#{agvControlStyle},
|
</if>
|
<if test="agvCurrentLandmarkRFID != null">
|
agv_current_landmark_rFID=#{agvCurrentLandmarkRFID},
|
</if>
|
<if test="agvDestRFID != null">
|
agv_dest_rFID=#{agvDestRFID},
|
</if>
|
<if test="agvEmergencyButton != null">
|
agv_emergency_button=#{agvEmergencyButton},
|
</if>
|
<if test="agvFrontLaserSwitch != null">
|
agv_front_laser_switch=#{agvFrontLaserSwitch},
|
</if>
|
<if test="agvId != null">
|
agv_id=#{agvId},
|
</if>
|
<if test="agvJackingState != null">
|
agv_jacking_state=#{agvJackingState},
|
</if>
|
<if test="agvLiftupHeavyState != null">
|
agv_liftup_heavy_state=#{agvLiftupHeavyState},
|
</if>
|
<if test="agvModelRFID != null">
|
agv_model_rFID=#{agvModelRFID},
|
</if>
|
<if test="agvMoveStyle != null">
|
agv_move_style=#{agvMoveStyle},
|
</if>
|
<if test="agvTaskState != null">
|
agv_task_state=#{agvTaskState},
|
</if>
|
<if test="agvVelDirection != null">
|
agv_vel_direction=#{agvVelDirection},
|
</if>
|
<if test="agvVelLevel != null">
|
agv_vel_level=#{agvVelLevel},
|
</if>
|
<if test="agvWorkingState != null">
|
agv_working_state=#{agvWorkingState},
|
</if>
|
<if test="battery1Charge != null">
|
battery1_charge=#{battery1Charge},
|
</if>
|
<if test="battery1Current != null">
|
battery1_current=#{battery1Current},
|
</if>
|
<if test="battery1ErrorCode != null">
|
battery1_error_code=#{battery1ErrorCode},
|
</if>
|
<if test="battery1Voltage != null">
|
battery1_voltage=#{battery1Voltage},
|
</if>
|
<if test="errorCode != null">
|
error_code=#{errorCode},
|
</if>
|
<if test="errorContent != null">
|
error_content=#{errorContent},
|
</if>
|
</set>
|
where id=#{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update t_agv_state_history
|
SET is_use = 0
|
where id=#{id}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from t_agv_state_history
|
where id=#{id}
|
</delete>
|
|
</mapper>
|