<?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">
<!-- namespace必须指向DAO接口 -->
<mapper namespace="com.jpsoft.shinestar.modules.base.dao.ParkingDeviceDAO">
    <sql id="Base_Column_List">
	id_,
	park_device_no,
	park_device_name,
	ip_port,
	key_,
	del_flag,
	create_by,
	create_time,
	update_by,
	update_time
</sql>
    <resultMap id="ParkingDeviceMap" type="com.jpsoft.shinestar.modules.base.entity.ParkingDevice">
        <result property="id" column="id_"/>
        <result property="parkDeviceNo" column="park_device_no"/>
        <result property="parkDeviceName" column="park_device_name"/>
        <result property="ipPort" column="ip_port"/>
        <result property="key" column="key_"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>

    </resultMap>
    <insert id="insert" parameterType="com.jpsoft.shinestar.modules.base.entity.ParkingDevice">
        <!--
        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="${pkFieldName}">
            select sys_guid() from dual
        </selectKey>
        -->
        <![CDATA[
		insert into base_parking_device
	    (park_device_no,park_device_name,ip_port,key_,del_flag,create_by,create_time,
	    update_by,update_time)
		values
		(
            #{parkDeviceNo,jdbcType=VARCHAR}
            ,#{parkDeviceName,jdbcType=VARCHAR}
            ,#{ipPort,jdbcType=VARCHAR}
            ,#{key,jdbcType=VARCHAR}
            ,#{delFlag,jdbcType= NUMERIC }
            ,#{createBy,jdbcType=VARCHAR}
            ,#{createTime,jdbcType= TIMESTAMP }
            ,#{updateBy,jdbcType=VARCHAR}
            ,#{updateTime,jdbcType= TIMESTAMP }

		)
	]]>
    </insert>
    <delete id="delete" parameterType="Long">
        delete from base_parking_device where id_=#{id,jdbcType=BIGINT}
    </delete>
    <update id="update" parameterType="com.jpsoft.shinestar.modules.base.entity.ParkingDevice">
        update base_parking_device
        <set>
            <if test="id!=null">
                id_=#{id,jdbcType=BIGINT},
            </if>
            <if test="parkDeviceNo!=null">
                park_device_no=#{parkDeviceNo,jdbcType=VARCHAR},
            </if>
            <if test="parkDeviceName!=null">
                park_device_name=#{parkDeviceName,jdbcType=VARCHAR},
            </if>
            <if test="ipPort!=null">
                ip_port=#{ipPort,jdbcType=VARCHAR},
            </if>
            <if test="key!=null">
                key_=#{key,jdbcType=VARCHAR},
            </if>
            <if test="delFlag!=null">
                del_flag=#{delFlag,jdbcType= NUMERIC },
            </if>
            <if test="createBy!=null">
                create_by=#{createBy,jdbcType=VARCHAR},
            </if>
            <if test="createTime!=null">
                create_time=#{createTime,jdbcType= TIMESTAMP },
            </if>
            <if test="updateBy!=null">
                update_by=#{updateBy,jdbcType=VARCHAR},
            </if>
            <if test="updateTime!=null">
                update_time=#{updateTime,jdbcType= TIMESTAMP },
            </if>
        </set>
        where id_=#{id}
    </update>
    <select id="get" parameterType="Long" resultMap="ParkingDeviceMap">
        select * from base_parking_device where id_=#{0}  and del_flag=0
    </select>
    <select id="exist" parameterType="Long" resultType="int">
        select count(*) from base_parking_device where id_=#{0}  and del_flag=0
    </select>
    <select id="list" resultMap="ParkingDeviceMap">
        select * from base_parking_device where del_flag=0
    </select>
    <select id="search" parameterType="hashmap" resultMap="ParkingDeviceMap">

    </select>

    <!--auto generated by MybatisCodeHelper on 2020-05-22-->
    <select id="findByParkDeviceNo" resultMap="ParkingDeviceMap">
        select
        <include refid="Base_Column_List"/>
        from base_parking_device
        where park_device_no=#{parkDeviceNo}
        and del_flag = 0
    </select>


</mapper>