<?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.TdPropertyInfoMapper">
    
    <resultMap type="TdPropertyInfo" id="TdPropertyInfoResult">
        <result property="id"    column="id"    />
        <result property="useId"    column="use_id"    />
        <result property="propertyBrand"    column="property_brand"    />
        <result property="propertyMac"    column="property_mac"    />
        <result property="propertyNetstyle"    column="property_netstyle"    />
        <result property="propertyType"    column="property_type"    />
        <result property="propertyNo"    column="property_no"    />
        <result property="propertyName"    column="property_name"    />
        <result property="computerType"    column="computer_type_"    />
        <result property="propertyMiji"    column="property_miji"    />
        <result property="propertySn"    column="property_SN"    />
        <result property="remark"    column="remark"    />
        <result property="isCurcial"    column="is_curcial"    />
        <result property="isSoftware"    column="is_software"    />
        <result property="username"    column="username"    />
        <result property="maintainDepart"    column="maintain_depart"    />
        <result property="maintainUser"    column="maintain_user"    />
        <result property="maintainDate"    column="maintain_date"    />
        <result property="maintainState"    column="maintain_state"    />
        <result property="destoryState"    column="destory_state"    />
        <result property="destoryDepart"    column="destory_depart"    />
        <result property="destoryUser"    column="destory_user"    />
        <result property="destoryDate"    column="destory_date"    />
        <result property="destoryType"    column="destory_type"    />
        <result property="propertyRefer"    column="property_refer"    />
        <result property="maintainRemark"    column="maintain_remark"    />
        <result property="shemichengdu"    column="shemichengdu"    />
        <result property="part"    column="part"    />
    </resultMap>

    <sql id="selectTdPropertyInfoVo">
        select id, use_id, property_brand, property_mac, property_netstyle, property_type, property_no, property_name, computer_type_, property_miji, property_SN, remark, is_curcial, is_software, username, maintain_depart, maintain_user, maintain_date, maintain_state, destory_state, destory_depart, destory_user, destory_date, destory_type, property_refer, maintain_remark, shemichengdu, part from td_property_info
    </sql>

    <select id="selectTdPropertyInfoList" parameterType="TdPropertyInfo" resultMap="TdPropertyInfoResult">
        <include refid="selectTdPropertyInfoVo"/>
        <where>
            <if test="id != null  and id != ''"> and id = #{id}</if>
            <if test="useId != null  and useId != ''"> and use_id = #{useId}</if>
            <if test="propertyBrand != null  and propertyBrand != ''"> and property_brand = #{propertyBrand}</if>
            <if test="propertyMac != null  and propertyMac != ''"> and property_mac = #{propertyMac}</if>
            <if test="propertyNetstyle != null  and propertyNetstyle != ''"> and property_netstyle = #{propertyNetstyle}</if>
            <if test="propertyType != null  and propertyType != ''"> and property_type = #{propertyType}</if>
            <if test="propertyNo != null  and propertyNo != ''"> and property_no = #{propertyNo}</if>
            <if test="propertyName != null  and propertyName != ''"> and property_name like concat('%', #{propertyName}, '%')</if>
            <if test="computerType != null  and computerType != ''"> and computer_type_ = #{computerType}</if>
            <if test="propertyMiji != null  and propertyMiji != ''"> and property_miji = #{propertyMiji}</if>
            <if test="propertySn != null  and propertySn != ''"> and property_SN = #{propertySn}</if>
            <if test="isCurcial != null  and isCurcial != ''"> and is_curcial = #{isCurcial}</if>
            <if test="isSoftware != null  and isSoftware != ''"> and is_software = #{isSoftware}</if>
            <if test="username != null  and username != ''"> and username like concat('%', #{username}, '%')</if>
            <if test="maintainDepart != null  and maintainDepart != ''"> and maintain_depart = #{maintainDepart}</if>
            <if test="maintainUser != null  and maintainUser != ''"> and maintain_user = #{maintainUser}</if>
            <if test="maintainDate != null "> and maintain_date = #{maintainDate}</if>
            <if test="maintainState != null  and maintainState != ''"> and maintain_state = #{maintainState}</if>
            <if test="destoryState != null  and destoryState != ''"> and destory_state = #{destoryState}</if>
            <if test="destoryDepart != null  and destoryDepart != ''"> and destory_depart = #{destoryDepart}</if>
            <if test="destoryUser != null  and destoryUser != ''"> and destory_user = #{destoryUser}</if>
            <if test="destoryDate != null "> and destory_date = #{destoryDate}</if>
            <if test="destoryType != null  and destoryType != ''"> and destory_type = #{destoryType}</if>
            <if test="propertyRefer != null  and propertyRefer != ''"> and property_refer = #{propertyRefer}</if>
            <if test="maintainRemark != null  and maintainRemark != ''"> and maintain_remark = #{maintainRemark}</if>
            <if test="shemichengdu != null  and shemichengdu != ''"> and shemichengdu = #{shemichengdu}</if>
            <if test="part != null  and part != ''"> and part = #{part}</if>
        </where>
    </select>
    
    <select id="selectTdPropertyInfoById" parameterType="String" resultMap="TdPropertyInfoResult">
        <include refid="selectTdPropertyInfoVo"/>
        where id = #{id}
    </select>

    <select id="selectTdPropertyInfoByUseId" parameterType="String" resultMap="TdPropertyInfoResult">
        <include refid="selectTdPropertyInfoVo"/>
        where use_id = #{id}
    </select>
        
    <insert id="insertTdPropertyInfo" parameterType="TdPropertyInfo">
        insert into td_property_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="useId != null">use_id,</if>
            <if test="propertyBrand != null">property_brand,</if>
            <if test="propertyMac != null">property_mac,</if>
            <if test="propertyNetstyle != null">property_netstyle,</if>
            <if test="propertyType != null">property_type,</if>
            <if test="propertyNo != null">property_no,</if>
            <if test="propertyName != null">property_name,</if>
            <if test="computerType != null">computer_type_,</if>
            <if test="propertyMiji != null">property_miji,</if>
            <if test="propertySn != null">property_SN,</if>
            <if test="remark != null">remark,</if>
            <if test="isCurcial != null">is_curcial,</if>
            <if test="isSoftware != null">is_software,</if>
            <if test="username != null">username,</if>
            <if test="maintainDepart != null">maintain_depart,</if>
            <if test="maintainUser != null">maintain_user,</if>
            <if test="maintainDate != null">maintain_date,</if>
            <if test="maintainState != null">maintain_state,</if>
            <if test="destoryState != null">destory_state,</if>
            <if test="destoryDepart != null">destory_depart,</if>
            <if test="destoryUser != null">destory_user,</if>
            <if test="destoryDate != null">destory_date,</if>
            <if test="destoryType != null">destory_type,</if>
            <if test="propertyRefer != null">property_refer,</if>
            <if test="maintainRemark != null">maintain_remark,</if>
            <if test="shemichengdu != null">shemichengdu,</if>
            <if test="part != null">part,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="useId != null">#{useId},</if>
            <if test="propertyBrand != null">#{propertyBrand},</if>
            <if test="propertyMac != null">#{propertyMac},</if>
            <if test="propertyNetstyle != null">#{propertyNetstyle},</if>
            <if test="propertyType != null">#{propertyType},</if>
            <if test="propertyNo != null">#{propertyNo},</if>
            <if test="propertyName != null">#{propertyName},</if>
            <if test="computerType != null">#{computerType},</if>
            <if test="propertyMiji != null">#{propertyMiji},</if>
            <if test="propertySn != null">#{propertySn},</if>
            <if test="remark != null">#{remark},</if>
            <if test="isCurcial != null">#{isCurcial},</if>
            <if test="isSoftware != null">#{isSoftware},</if>
            <if test="username != null">#{username},</if>
            <if test="maintainDepart != null">#{maintainDepart},</if>
            <if test="maintainUser != null">#{maintainUser},</if>
            <if test="maintainDate != null">#{maintainDate},</if>
            <if test="maintainState != null">#{maintainState},</if>
            <if test="destoryState != null">#{destoryState},</if>
            <if test="destoryDepart != null">#{destoryDepart},</if>
            <if test="destoryUser != null">#{destoryUser},</if>
            <if test="destoryDate != null">#{destoryDate},</if>
            <if test="destoryType != null">#{destoryType},</if>
            <if test="propertyRefer != null">#{propertyRefer},</if>
            <if test="maintainRemark != null">#{maintainRemark},</if>
            <if test="shemichengdu != null">#{shemichengdu},</if>
            <if test="part != null">#{part},</if>
         </trim>
    </insert>

    <update id="updateTdPropertyInfo" parameterType="TdPropertyInfo">
        update td_property_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="useId != null">use_id = #{useId},</if>
            <if test="propertyBrand != null">property_brand = #{propertyBrand},</if>
            <if test="propertyMac != null">property_mac = #{propertyMac},</if>
            <if test="propertyNetstyle != null">property_netstyle = #{propertyNetstyle},</if>
            <if test="propertyType != null">property_type = #{propertyType},</if>
            <if test="propertyNo != null">property_no = #{propertyNo},</if>
            <if test="propertyName != null">property_name = #{propertyName},</if>
            <if test="computerType != null">computer_type_ = #{computerType},</if>
            <if test="propertyMiji != null">property_miji = #{propertyMiji},</if>
            <if test="propertySn != null">property_SN = #{propertySn},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="isCurcial != null">is_curcial = #{isCurcial},</if>
            <if test="isSoftware != null">is_software = #{isSoftware},</if>
            <if test="username != null">username = #{username},</if>
            <if test="maintainDepart != null">maintain_depart = #{maintainDepart},</if>
            <if test="maintainUser != null">maintain_user = #{maintainUser},</if>
            <if test="maintainDate != null">maintain_date = #{maintainDate},</if>
            <if test="maintainState != null">maintain_state = #{maintainState},</if>
            <if test="destoryState != null">destory_state = #{destoryState},</if>
            <if test="destoryDepart != null">destory_depart = #{destoryDepart},</if>
            <if test="destoryUser != null">destory_user = #{destoryUser},</if>
            <if test="destoryDate != null">destory_date = #{destoryDate},</if>
            <if test="destoryType != null">destory_type = #{destoryType},</if>
            <if test="propertyRefer != null">property_refer = #{propertyRefer},</if>
            <if test="maintainRemark != null">maintain_remark = #{maintainRemark},</if>
            <if test="shemichengdu != null">shemichengdu = #{shemichengdu},</if>
            <if test="part != null">part = #{part},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTdPropertyInfoById" parameterType="String">
        delete from td_property_info where id = #{id}
    </delete>

    <delete id="deleteTdPropertyInfoByIds" parameterType="String">
        delete from td_property_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>