<?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="cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapLineMapper">

    <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapLineDO">
        <!--@Table ware_position_map_line-->
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="positionMapId" column="position_map_id" jdbcType="INTEGER"/>
        <result property="startingPointId" column="starting_point_id" jdbcType="INTEGER"/>
        <result property="endPointId" column="end_point_id" jdbcType="INTEGER"/>
        <result property="beginControlX" column="begin_control_x" jdbcType="VARCHAR"/>
        <result property="beginControlY" column="begin_control_y" jdbcType="VARCHAR"/>
        <result property="endControlX" column="end_control_x" jdbcType="VARCHAR"/>
        <result property="endControlY" column="end_control_y" jdbcType="VARCHAR"/>
        <result property="expansionZoneFront" column="expansion_zone_front" jdbcType="NUMERIC"/>
        <result property="expansionZoneAfter" column="expansion_zone_after" jdbcType="NUMERIC"/>
        <result property="expansionZoneLeft" column="expansion_zone_left" jdbcType="NUMERIC"/>
        <result property="expansionZoneRight" column="expansion_zone_right" jdbcType="NUMERIC"/>
        <result property="method" column="method" jdbcType="INTEGER"/>
        <result property="direction" column="direction" jdbcType="INTEGER"/>
        <result property="forwardSpeedLimit" column="forward_speed_limit" jdbcType="NUMERIC"/>
        <result property="reverseSpeedLimit" column="reverse_speed_limit" jdbcType="NUMERIC"/>
        <result property="creator" column="creator" jdbcType="VARCHAR"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updater" column="updater" jdbcType="VARCHAR"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
        <result property="deleted" column="deleted" jdbcType="INTEGER"/>
        <result property="toward" column="toward" jdbcType="INTEGER"/>
        <result property="actualStartPointX" column="actual_start_point_x" jdbcType="DOUBLE"/>
        <result property="actualStartPointY" column="actual_start_point_y" jdbcType="DOUBLE"/>
        <result property="actualEndPointX" column="actual_end_point_x" jdbcType="DOUBLE"/>
        <result property="actualEndPointY" column="actual_end_point_y" jdbcType="DOUBLE"/>
        <result property="actualBeginControlX" column="actual_begin_control_x" jdbcType="DOUBLE"/>
        <result property="actualBeginControlY" column="actual_begin_control_y" jdbcType="DOUBLE"/>
        <result property="actualEndControlX" column="actual_end_control_x" jdbcType="DOUBLE"/>
        <result property="actualEndControlY" column="actual_end_control_y" jdbcType="DOUBLE"/>
    </resultMap>
    <update id="deleteByMapId">
        update ware_position_map_line
        set deleted = 1
        where position_map_id = #{mapId}
    </update>

    <!--查询单个-->
    <select id="queryById" resultMap="BaseResultMap">
        select
            id, position_map_id, starting_point_id, end_point_id, begin_control_x, begin_control_y, end_control_x, end_control_y, expansion_zone_front, expansion_zone_after, expansion_zone_left, expansion_zone_right, method, direction, forward_speed_limit, reverse_speed_limit, creator, create_time, updater, update_time, deleted, tenant_id, toward
        from ware_position_map_line
        where id = #{id}
    </select>

    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultMap="BaseResultMap">
        select
        id, position_map_id, starting_point_id, end_point_id, begin_control_x, begin_control_y, end_control_x, end_control_y, expansion_zone_front, expansion_zone_after, expansion_zone_left, expansion_zone_right, method, direction, forward_speed_limit, reverse_speed_limit, creator, create_time, updater, update_time, deleted, tenant_id, toward
        from ware_position_map_line
        <where>
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="positionMapId != null">
                and position_map_id = #{positionMapId}
            </if>
            <if test="startingPointId != null">
                and starting_point_id = #{startingPointId}
            </if>
            <if test="endPointId != null">
                and end_point_id = #{endPointId}
            </if>
            <if test="beginControlX != null and beginControlX != ''">
                and begin_control_x = #{beginControlX}
            </if>
            <if test="beginControlY != null and beginControlY != ''">
                and begin_control_y = #{beginControlY}
            </if>
            <if test="endControlX != null and endControlX != ''">
                and end_control_x = #{endControlX}
            </if>
            <if test="endControlY != null and endControlY != ''">
                and end_control_y = #{endControlY}
            </if>
            <if test="expansionZoneFront != null">
                and expansion_zone_front = #{expansionZoneFront}
            </if>
            <if test="expansionZoneAfter != null">
                and expansion_zone_after = #{expansionZoneAfter}
            </if>
            <if test="expansionZoneLeft != null">
                and expansion_zone_left = #{expansionZoneLeft}
            </if>
            <if test="expansionZoneRight != null">
                and expansion_zone_right = #{expansionZoneRight}
            </if>
            <if test="method != null">
                and method = #{method}
            </if>
            <if test="direction != null">
                and direction = #{direction}
            </if>
            <if test="forwardSpeedLimit != null">
                and forward_speed_limit = #{forwardSpeedLimit}
            </if>
            <if test="reverseSpeedLimit != null">
                and reverse_speed_limit = #{reverseSpeedLimit}
            </if>
            <if test="creator != null and creator != ''">
                and creator = #{creator}
            </if>
            <if test="createTime != null">
                and create_time = #{createTime}
            </if>
            <if test="updater != null and updater != ''">
                and updater = #{updater}
            </if>
            <if test="updateTime != null">
                and update_time = #{updateTime}
            </if>
            <if test="deleted != null">
                and deleted = #{deleted}
            </if>
            <if test="toward != null">
                and toward = #{toward}
            </if>
        </where>
        limit #{pageable.offset}, #{pageable.pageSize}
    </select>

    <!--通过实体作为筛选条件查询-->
    <sql id="base_sql" >
      id,
      position_map_id,
      starting_point_id,
      end_point_id,
      begin_control_x,
      begin_control_y,
      end_control_x,
      end_control_y,
      expansion_zone_front,
      expansion_zone_after,
      expansion_zone_left,
      expansion_zone_right,
      method,
      direction,
      forward_speed_limit,
      reverse_speed_limit,
      creator,
      toward,
      actual_start_point_x,
      actual_start_point_y,
      actual_end_point_x,
      actual_end_point_y,
      actual_begin_control_x,
      actual_begin_control_y,
      actual_end_control_x,
      actual_end_control_y,
      collision_avoidance_flag

    </sql>
    <!--统计总行数-->
    <select id="count" resultType="java.lang.Long">
        select count(1)
        from ware_position_map_line
        <where>
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="positionMapId != null">
                and position_map_id = #{positionMapId}
            </if>
            <if test="startingPointId != null">
                and starting_point_id = #{startingPointId}
            </if>
            <if test="endPointId != null">
                and end_point_id = #{endPointId}
            </if>
            <if test="beginControlX != null and beginControlX != ''">
                and begin_control_x = #{beginControlX}
            </if>
            <if test="beginControlY != null and beginControlY != ''">
                and begin_control_y = #{beginControlY}
            </if>
            <if test="endControlX != null and endControlX != ''">
                and end_control_x = #{endControlX}
            </if>
            <if test="endControlY != null and endControlY != ''">
                and end_control_y = #{endControlY}
            </if>
            <if test="expansionZoneFront != null">
                and expansion_zone_front = #{expansionZoneFront}
            </if>
            <if test="expansionZoneAfter != null">
                and expansion_zone_after = #{expansionZoneAfter}
            </if>
            <if test="expansionZoneLeft != null">
                and expansion_zone_left = #{expansionZoneLeft}
            </if>
            <if test="expansionZoneRight != null">
                and expansion_zone_right = #{expansionZoneRight}
            </if>
            <if test="method != null">
                and method = #{method}
            </if>
            <if test="direction != null">
                and direction = #{direction}
            </if>
            <if test="forwardSpeedLimit != null">
                and forward_speed_limit = #{forwardSpeedLimit}
            </if>
            <if test="reverseSpeedLimit != null">
                and reverse_speed_limit = #{reverseSpeedLimit}
            </if>
            <if test="creator != null and creator != ''">
                and creator = #{creator}
            </if>
            <if test="createTime != null">
                and create_time = #{createTime}
            </if>
            <if test="updater != null and updater != ''">
                and updater = #{updater}
            </if>
            <if test="updateTime != null">
                and update_time = #{updateTime}
            </if>
            <if test="deleted != null">
                and deleted = #{deleted}
            </if>
            <if test="toward != null">
                and toward = #{toward}
            </if>
        </where>
    </select>

    <select id="getAllPositionMapLine"
            resultType="cn.iocoder.yudao.module.mqtt.api.path.dto.PositionMapLineDTO">
        select
            <include refid="base_sql"></include>
        from
            ware_position_map_line
        <where>
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="positionMapId != null">
                and position_map_id = #{positionMapId}
            </if>
            <if test="startingPointId != null">
                and starting_point_id = #{startingPointId}
            </if>
            <if test="endPointId != null">
                and end_point_id = #{endPointId}
            </if>
            <if test="beginControlX != null and beginControlX != ''">
                and begin_control_x = #{beginControlX}
            </if>
            <if test="beginControlY != null and beginControlY != ''">
                and begin_control_y = #{beginControlY}
            </if>
            <if test="endControlX != null and endControlX != ''">
                and end_control_x = #{endControlX}
            </if>
            <if test="endControlY != null and endControlY != ''">
                and end_control_y = #{endControlY}
            </if>
            <if test="expansionZoneFront != null">
                and expansion_zone_front = #{expansionZoneFront}
            </if>
            <if test="expansionZoneAfter != null">
                and expansion_zone_after = #{expansionZoneAfter}
            </if>
            <if test="expansionZoneLeft != null">
                and expansion_zone_left = #{expansionZoneLeft}
            </if>
            <if test="expansionZoneRight != null">
                and expansion_zone_right = #{expansionZoneRight}
            </if>
            <if test="method != null">
                and method = #{method}
            </if>
            <if test="direction != null">
                and direction = #{direction}
            </if>
            <if test="forwardSpeedLimit != null">
                and forward_speed_limit = #{forwardSpeedLimit}
            </if>
            <if test="reverseSpeedLimit != null">
                and reverse_speed_limit = #{reverseSpeedLimit}
            </if>
            <if test="creator != null and creator != ''">
                and creator = #{creator}
            </if>
            <if test="createTime != null">
                and create_time = #{createTime}
            </if>
            <if test="updater != null and updater != ''">
                and updater = #{updater}
            </if>
            <if test="updateTime != null">
                and update_time = #{updateTime}
            </if>
                and deleted = '0'
            <if test="toward != null">
                and toward = #{toward}
            </if>
        </where>
    </select>


    <!--通过主键修改数据-->
    <update id="updateBySelect">
        update ware_position_map_line
        <set>
            <if test="positionMapId != null">
                position_map_id = #{positionMapId},
            </if>
            <if test="startingPointId != null">
                starting_point_id = #{startingPointId},
            </if>
            <if test="endPointId != null">
                end_point_id = #{endPointId},
            </if>
            <if test="beginControlX != null and beginControlX != ''">
                begin_control_x = #{beginControlX},
            </if>
            <if test="beginControlY != null and beginControlY != ''">
                begin_control_y = #{beginControlY},
            </if>
            <if test="endControlX != null and endControlX != ''">
                end_control_x = #{endControlX},
            </if>
            <if test="endControlY != null and endControlY != ''">
                end_control_y = #{endControlY},
            </if>
            <if test="expansionZoneFront != null">
                expansion_zone_front = #{expansionZoneFront},
            </if>
            <if test="expansionZoneAfter != null">
                expansion_zone_after = #{expansionZoneAfter},
            </if>
            <if test="expansionZoneLeft != null">
                expansion_zone_left = #{expansionZoneLeft},
            </if>
            <if test="expansionZoneRight != null">
                expansion_zone_right = #{expansionZoneRight},
            </if>
            <if test="method != null">
                method = #{method},
            </if>
            <if test="direction != null">
                direction = #{direction},
            </if>
            <if test="forwardSpeedLimit != null">
                forward_speed_limit = #{forwardSpeedLimit},
            </if>
            <if test="reverseSpeedLimit != null">
                reverse_speed_limit = #{reverseSpeedLimit},
            </if>
            <if test="creator != null and creator != ''">
                creator = #{creator},
            </if>
            <if test="createTime != null">
                create_time = #{createTime},
            </if>
            <if test="updater != null and updater != ''">
                updater = #{updater},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime},
            </if>
            <if test="deleted != null">
                deleted = #{deleted},
            </if>
            <if test="toward != null">
                toward = #{toward},
            </if>
        </set>
        where id = #{id}
    </update>


</mapper>
