<?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.sckw.slope.detection.dao.mysql.KwsDeviceModelMapper">
    <resultMap id="BaseResultMap" type="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
        <!--@mbg.generated-->
        <!--@Table kws_device_model-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="identify_code" jdbcType="VARCHAR" property="identifyCode"/>
        <result column="device_type" jdbcType="VARCHAR" property="deviceType"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="manufacturer" jdbcType="VARCHAR" property="manufacturer"/>
        <result column="manufacturer_contacts" jdbcType="VARCHAR" property="manufacturerContacts"/>
        <result column="manufacturer_phone" jdbcType="VARCHAR" property="manufacturerPhone"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="mountain_id" jdbcType="VARCHAR" property="mountainId"/>
        <result column="status" jdbcType="TINYINT" property="status"/>
        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id,
        identify_code,
        device_type,
        `name`,
        manufacturer,
        manufacturer_contacts,
        manufacturer_phone,
        remark,
        `status`,
        create_by,
        create_time,
        update_by,
        update_time,
        del_flag,
        mountain_id
    </sql>
    <select id="selectListAll" resultType="com.sckw.slope.detection.model.vo.DeviceModelVo">
        select
        <include refid="Base_Column_List"/>
        from kws_device_model
        where del_flag = 0
        <if test="deviceModelQuery.name != null and deviceModelQuery.name != ''">
            and name like concat('%', #{deviceModelQuery.name}, '%')
        </if>
        <if test="deviceModelQuery.status != null and deviceModelQuery.status != ''">
            and status = #{deviceModelQuery.Status,jdbcType=TINYINT}
        </if>
        <if test="deviceModelQuery.mountainId != null and deviceModelQuery.mountainId != ''">
            and mountain_id = #{deviceModelQuery.mountainId,jdbcType=BIGINT}
        </if>
        order by create_time desc
    </select>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        <!--@mbg.generated-->
        select
        <include refid="Base_Column_List"/>
        from kws_device_model
        where id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        delete
        from kws_device_model
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
        <!--@mbg.generated-->
        insert into kws_device_model (id, identify_code, device_type,
                                      `name`, manufacturer, manufacturer_contacts,
                                      manufacturer_phone, remark, `status`,
                                      create_by, create_time, update_by,
                                      update_time, del_flag, mountain_id,`range`)
        values (#{id,jdbcType=BIGINT}, #{identifyCode,jdbcType=VARCHAR}, #{deviceType,jdbcType=VARCHAR},
                #{name,jdbcType=VARCHAR}, #{manufacturer,jdbcType=VARCHAR}, #{manufacturerContacts,jdbcType=VARCHAR},
                #{manufacturerPhone,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
                #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT},
                #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=TINYINT}, #{mountainId,jdbcType=VARCHAR}, #{range,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
        <!--@mbg.generated-->
        insert into kws_device_model
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="identifyCode != null">
                identify_code,
            </if>
            <if test="deviceType != null">
                device_type,
            </if>
            <if test="name != null">
                `name`,
            </if>
            <if test="manufacturer != null">
                manufacturer,
            </if>
            <if test="manufacturerContacts != null">
                manufacturer_contacts,
            </if>
            <if test="manufacturerPhone != null">
                manufacturer_phone,
            </if>
            <if test="remark != null">
                remark,
            </if>
            <if test="status != null">
                `status`,
            </if>
            <if test="createBy != null">
                create_by,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateBy != null">
                update_by,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="delFlag != null">
                del_flag,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="identifyCode != null">
                #{identifyCode,jdbcType=VARCHAR},
            </if>
            <if test="deviceType != null">
                #{deviceType,jdbcType=VARCHAR},
            </if>
            <if test="name != null">
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="manufacturer != null">
                #{manufacturer,jdbcType=VARCHAR},
            </if>
            <if test="manufacturerContacts != null">
                #{manufacturerContacts,jdbcType=VARCHAR},
            </if>
            <if test="manufacturerPhone != null">
                #{manufacturerPhone,jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=TINYINT},
            </if>
            <if test="createBy != null">
                #{createBy,jdbcType=BIGINT},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateBy != null">
                #{updateBy,jdbcType=BIGINT},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="delFlag != null">
                #{delFlag,jdbcType=TINYINT},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
        <!--@mbg.generated-->
        update kws_device_model
        <set>
            <if test="identifyCode != null">
                identify_code = #{identifyCode,jdbcType=VARCHAR},
            </if>
            <if test="deviceType != null">
                device_type = #{deviceType,jdbcType=VARCHAR},
            </if>
            <if test="name != null">
                `name` = #{name,jdbcType=VARCHAR},
            </if>
            <if test="manufacturer != null">
                manufacturer = #{manufacturer,jdbcType=VARCHAR},
            </if>
            <if test="manufacturerContacts != null">
                manufacturer_contacts = #{manufacturerContacts,jdbcType=VARCHAR},
            </if>
            <if test="manufacturerPhone != null">
                manufacturer_phone = #{manufacturerPhone,jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                remark = #{remark,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                `status` = #{status,jdbcType=TINYINT},
            </if>
            <if test="createBy != null">
                create_by = #{createBy,jdbcType=BIGINT},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateBy != null">
                update_by = #{updateBy,jdbcType=BIGINT},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="delFlag != null">
                del_flag = #{delFlag,jdbcType=TINYINT},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsDeviceModel">
        <!--@mbg.generated-->
        update kws_device_model
        set identify_code         = #{identifyCode,jdbcType=VARCHAR},
            device_type           = #{deviceType,jdbcType=VARCHAR},
            `name`                = #{name,jdbcType=VARCHAR},
            manufacturer          = #{manufacturer,jdbcType=VARCHAR},
            manufacturer_contacts = #{manufacturerContacts,jdbcType=VARCHAR},
            manufacturer_phone    = #{manufacturerPhone,jdbcType=VARCHAR},
            remark                = #{remark,jdbcType=VARCHAR},
            `status`              = #{status,jdbcType=TINYINT},
            create_by             = #{createBy,jdbcType=BIGINT},
            create_time           = #{createTime,jdbcType=TIMESTAMP},
            update_by             = #{updateBy,jdbcType=BIGINT},
            update_time           = #{updateTime,jdbcType=TIMESTAMP},
            del_flag              = #{delFlag,jdbcType=TINYINT}
        where id = #{id,jdbcType=BIGINT}
    </update>
</mapper>