<?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.ruoyi.system.mapper.SiteConfigMapper">

    <resultMap type="com.ruoyi.system.domain.SiteConfig" id="SiteConfigMap">
        <result property="configId" column="config_id" jdbcType="INTEGER"/>
        <result property="siteId" column="site_id" jdbcType="INTEGER"/>
        <result property="type" column="type" jdbcType="INTEGER"/>
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="local" column="local" jdbcType="INTEGER"/>
        <result property="offset" column="offset" jdbcType="NUMERIC"/>
        <result property="stoptime" column="stoptime" jdbcType="INTEGER"/>
        <result property="wltime" column="wltime" jdbcType="INTEGER"/>
        <result property="speed" column="speed" jdbcType="INTEGER"/>
        <result property="wlevelmin" column="wlevelmin" jdbcType="NUMERIC"/>
        <result property="wlevelmax" column="wlevelmax" jdbcType="NUMERIC"/>
        <result property="eqmin" column="eqmin" jdbcType="INTEGER"/>
        <result property="wbaselevel" column="wbaselevel" jdbcType="NUMERIC"/>
        <result property="wladdr" column="wladdr" jdbcType="INTEGER"/>
        <result property="wltype" column="wltype" jdbcType="INTEGER"/>
        <result property="wlfirstadd" column="wlfirstadd" jdbcType="INTEGER"/>
        <result property="wlzoom" column="wlzoom" jdbcType="NUMERIC"/>
        <result property="wllength" column="wllength" jdbcType="INTEGER"/>
        <result property="wlunit" column="wlunit" jdbcType="INTEGER"/>
        <result property="wloffset" column="wloffset" jdbcType="INTEGER"/>
        <result property="wlfactor" column="wlfactor" jdbcType="NUMERIC"/>
        <result property="wsaddr" column="wsaddr" jdbcType="INTEGER"/>
        <result property="wstype" column="wstype" jdbcType="INTEGER"/>
        <result property="wsfirstadd" column="wsfirstadd" jdbcType="INTEGER"/>
        <result property="wszoom" column="wszoom" jdbcType="NUMERIC"/>
        <result property="wslength" column="wslength" jdbcType="INTEGER"/>
        <result property="wsunit" column="wsunit" jdbcType="INTEGER"/>
        <result property="wsoffset" column="wsoffset" jdbcType="NUMERIC"/>
        <result property="wsfactor" column="wsfactor" jdbcType="NUMERIC"/>
    </resultMap>

    <!--查询单个-->
    <select id="queryById" resultMap="SiteConfigMap">
        select
config_id, site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor
        from site_config
        where config_id = #{configId}
    </select>

    <!--查询单个-->
    <select id="queryBySiteId" resultMap="SiteConfigMap">
        select
            config_id, site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor
        from site_config
        where site_id = #{siteId}
    </select>

    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultMap="SiteConfigMap">
        select
config_id, site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor
        from site_config
        <where>
            <if test="configId != null">
                and config_id = #{configId}
            </if>
            <if test="siteId != null">
                and site_id = #{siteId}
            </if>
            <if test="type != null">
                and type = #{type}
            </if>
            <if test="id != null and id != ''">
                and id = #{id}
            </if>
            <if test="local != null">
                and local = #{local}
            </if>
            <if test="offset != null">
                and offset = #{offset}
            </if>
            <if test="stoptime != null">
                and stoptime = #{stoptime}
            </if>
            <if test="wltime != null">
                and wltime = #{wltime}
            </if>
            <if test="speed != null">
                and speed = #{speed}
            </if>
            <if test="wlevelmin != null">
                and wlevelmin = #{wlevelmin}
            </if>
            <if test="wlevelmax != null">
                and wlevelmax = #{wlevelmax}
            </if>
            <if test="eqmin != null">
                and eqmin = #{eqmin}
            </if>
            <if test="wbaselevel != null">
                and wbaselevel = #{wbaselevel}
            </if>
            <if test="wladdr != null">
                and wladdr = #{wladdr}
            </if>
            <if test="wltype != null">
                and wltype = #{wltype}
            </if>
            <if test="wlfirstadd != null">
                and wlfirstadd = #{wlfirstadd}
            </if>
            <if test="wlzoom != null">
                and wlzoom = #{wlzoom}
            </if>
            <if test="wllength != null">
                and wllength = #{wllength}
            </if>
            <if test="wlunit != null">
                and wlunit = #{wlunit}
            </if>
            <if test="wloffset != null">
                and wloffset = #{wloffset}
            </if>
            <if test="wlfactor != null">
                and wlfactor = #{wlfactor}
            </if>
            <if test="wsaddr != null">
                and wsaddr = #{wsaddr}
            </if>
            <if test="wstype != null">
                and wstype = #{wstype}
            </if>
            <if test="wsfirstadd != null">
                and wsfirstadd = #{wsfirstadd}
            </if>
            <if test="wszoom != null">
                and wszoom = #{wszoom}
            </if>
            <if test="wslength != null">
                and wslength = #{wslength}
            </if>
            <if test="wsunit != null">
                and wsunit = #{wsunit}
            </if>
            <if test="wsoffset != null">
                and wsoffset = #{wsoffset}
            </if>
            <if test="wsfactor != null">
                and wsfactor = #{wsfactor}
            </if>
        </where>
        limit #{pageable.offset}, #{pageable.pageSize}
    </select>

    <!--统计总行数-->
    <select id="count" resultType="java.lang.Long">
        select count(1)
        from site_config
        <where>
            <if test="configId != null">
                and config_id = #{configId}
            </if>
            <if test="siteId != null">
                and site_id = #{siteId}
            </if>
            <if test="type != null">
                and type = #{type}
            </if>
            <if test="id != null and id != ''">
                and id = #{id}
            </if>
            <if test="local != null">
                and local = #{local}
            </if>
            <if test="offset != null">
                and offset = #{offset}
            </if>
            <if test="stoptime != null">
                and stoptime = #{stoptime}
            </if>
            <if test="wltime != null">
                and wltime = #{wltime}
            </if>
            <if test="speed != null">
                and speed = #{speed}
            </if>
            <if test="wlevelmin != null">
                and wlevelmin = #{wlevelmin}
            </if>
            <if test="wlevelmax != null">
                and wlevelmax = #{wlevelmax}
            </if>
            <if test="eqmin != null">
                and eqmin = #{eqmin}
            </if>
            <if test="wbaselevel != null">
                and wbaselevel = #{wbaselevel}
            </if>
            <if test="wladdr != null">
                and wladdr = #{wladdr}
            </if>
            <if test="wltype != null">
                and wltype = #{wltype}
            </if>
            <if test="wlfirstadd != null">
                and wlfirstadd = #{wlfirstadd}
            </if>
            <if test="wlzoom != null">
                and wlzoom = #{wlzoom}
            </if>
            <if test="wllength != null">
                and wllength = #{wllength}
            </if>
            <if test="wlunit != null">
                and wlunit = #{wlunit}
            </if>
            <if test="wloffset != null">
                and wloffset = #{wloffset}
            </if>
            <if test="wlfactor != null">
                and wlfactor = #{wlfactor}
            </if>
            <if test="wsaddr != null">
                and wsaddr = #{wsaddr}
            </if>
            <if test="wstype != null">
                and wstype = #{wstype}
            </if>
            <if test="wsfirstadd != null">
                and wsfirstadd = #{wsfirstadd}
            </if>
            <if test="wszoom != null">
                and wszoom = #{wszoom}
            </if>
            <if test="wslength != null">
                and wslength = #{wslength}
            </if>
            <if test="wsunit != null">
                and wsunit = #{wsunit}
            </if>
            <if test="wsoffset != null">
                and wsoffset = #{wsoffset}
            </if>
            <if test="wsfactor != null">
                and wsfactor = #{wsfactor}
            </if>
        </where>
    </select>

    <!--新增所有列-->
    <insert id="insert" keyProperty="configId" useGeneratedKeys="true">
        insert into site_config(site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor)
        values (#{siteId}, #{type}, #{id}, #{local}, #{offset}, #{stoptime}, #{wltime}, #{speed}, #{wlevelmin}, #{wlevelmax}, #{eqmin}, #{wbaselevel}, #{wladdr}, #{wltype}, #{wlfirstadd}, #{wlzoom}, #{wllength}, #{wlunit}, #{wloffset}, #{wlfactor}, #{wsaddr}, #{wstype}, #{wsfirstadd}, #{wszoom}, #{wslength}, #{wsunit}, #{wsoffset}, #{wsfactor})
    </insert>

    <insert id="insertBatch" keyProperty="configId" useGeneratedKeys="true">
        insert into site_config(site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor)
        values
        <foreach collection="entities" item="entity" separator=",">
        (#{entity.siteId}, #{entity.type}, #{entity.id}, #{entity.local}, #{entity.offset}, #{entity.stoptime}, #{entity.wltime}, #{entity.speed}, #{entity.wlevelmin}, #{entity.wlevelmax}, #{entity.eqmin}, #{entity.wbaselevel}, #{entity.wladdr}, #{entity.wltype}, #{entity.wlfirstadd}, #{entity.wlzoom}, #{entity.wllength}, #{entity.wlunit}, #{entity.wloffset}, #{entity.wlfactor}, #{entity.wsaddr}, #{entity.wstype}, #{entity.wsfirstadd}, #{entity.wszoom}, #{entity.wslength}, #{entity.wsunit}, #{entity.wsoffset}, #{entity.wsfactor})
        </foreach>
    </insert>

    <insert id="insertOrUpdateBatch" keyProperty="configId" useGeneratedKeys="true">
        insert into site_config(site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.siteId}, #{entity.type}, #{entity.id}, #{entity.local}, #{entity.offset}, #{entity.stoptime}, #{entity.wltime}, #{entity.speed}, #{entity.wlevelmin}, #{entity.wlevelmax}, #{entity.eqmin}, #{entity.wbaselevel}, #{entity.wladdr}, #{entity.wltype}, #{entity.wlfirstadd}, #{entity.wlzoom}, #{entity.wllength}, #{entity.wlunit}, #{entity.wloffset}, #{entity.wlfactor}, #{entity.wsaddr}, #{entity.wstype}, #{entity.wsfirstadd}, #{entity.wszoom}, #{entity.wslength}, #{entity.wsunit}, #{entity.wsoffset}, #{entity.wsfactor})
        </foreach>
        on duplicate key update
site_id = values(site_id),
type = values(type),
id = values(id),
local = values(local),
offset = values(offset),
stoptime = values(stoptime),
wltime = values(wltime),
speed = values(speed),
wlevelmin = values(wlevelmin),
wlevelmax = values(wlevelmax),
eqmin = values(eqmin),
wbaselevel = values(wbaselevel),
wladdr = values(wladdr),
wltype = values(wltype),
wlfirstadd = values(wlfirstadd),
wlzoom = values(wlzoom),
wllength = values(wllength),
wlunit = values(wlunit),
wloffset = values(wloffset),
wlfactor = values(wlfactor),
wsaddr = values(wsaddr),
wstype = values(wstype),
wsfirstadd = values(wsfirstadd),
wszoom = values(wszoom),
wslength = values(wslength),
wsunit = values(wsunit),
wsoffset = values(wsoffset),
wsfactor = values(wsfactor)
    </insert>

    <!--通过主键修改数据-->
    <update id="update">
        update site_config
        <set>
            <if test="siteId != null">
                site_id = #{siteId},
            </if>
            <if test="type != null">
                type = #{type},
            </if>
            <if test="id != null and id != ''">
                id = #{id},
            </if>
            <if test="local != null">
                local = #{local},
            </if>
            <if test="offset != null">
                offset = #{offset},
            </if>
            <if test="stoptime != null">
                stoptime = #{stoptime},
            </if>
            <if test="wltime != null">
                wltime = #{wltime},
            </if>
            <if test="speed != null">
                speed = #{speed},
            </if>
            <if test="wlevelmin != null">
                wlevelmin = #{wlevelmin},
            </if>
            <if test="wlevelmax != null">
                wlevelmax = #{wlevelmax},
            </if>
            <if test="eqmin != null">
                eqmin = #{eqmin},
            </if>
            <if test="wbaselevel != null">
                wbaselevel = #{wbaselevel},
            </if>
            <if test="wladdr != null">
                wladdr = #{wladdr},
            </if>
            <if test="wltype != null">
                wltype = #{wltype},
            </if>
            <if test="wlfirstadd != null">
                wlfirstadd = #{wlfirstadd},
            </if>
            <if test="wlzoom != null">
                wlzoom = #{wlzoom},
            </if>
            <if test="wllength != null">
                wllength = #{wllength},
            </if>
            <if test="wlunit != null">
                wlunit = #{wlunit},
            </if>
            <if test="wloffset != null">
                wloffset = #{wloffset},
            </if>
            <if test="wlfactor != null">
                wlfactor = #{wlfactor},
            </if>
            <if test="wsaddr != null">
                wsaddr = #{wsaddr},
            </if>
            <if test="wstype != null">
                wstype = #{wstype},
            </if>
            <if test="wsfirstadd != null">
                wsfirstadd = #{wsfirstadd},
            </if>
            <if test="wszoom != null">
                wszoom = #{wszoom},
            </if>
            <if test="wslength != null">
                wslength = #{wslength},
            </if>
            <if test="wsunit != null">
                wsunit = #{wsunit},
            </if>
            <if test="wsoffset != null">
                wsoffset = #{wsoffset},
            </if>
            <if test="wsfactor != null">
                wsfactor = #{wsfactor},
            </if>
        </set>
        where config_id = #{configId}
    </update>

    <!--通过主键删除-->
    <delete id="deleteById">
        delete from site_config where config_id = #{configId}
    </delete>

</mapper>

