<?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.house.HouseResourceAssociationObjectMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.house.HouseResourceAssociationObject">
        <id property="id" column="id" jdbcType="VARCHAR"/>
        <result property="type" column="type" jdbcType="INTEGER"/>
        <result property="houseResourceId" column="house_resource_id" jdbcType="VARCHAR"/>
        <result property="businessId" column="business_id" jdbcType="VARCHAR"/>
    </resultMap>

    <insert id="insertHouseResourceObjectAssociation" parameterType="com.ruoyi.system.domain.house.HouseResourceAssociationObject">
        INSERT INTO house_resource_association_object
            (id, type, house_resource_id, business_id)
        VALUES
            (#{id,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
             #{houseResourceId,jdbcType=VARCHAR}, #{businessId,jdbcType=VARCHAR})
    </insert>

    <select id="selectHouseResourceObjectAssociationById" parameterType="String" resultType="com.ruoyi.system.domain.house.HouseResourceAssociationObject">
        SELECT id, type, house_resource_id, business_id
        FROM house_resource_association_object
        WHERE id = #{id}
    </select>

    <update id="updateHouseResourceObjectAssociation" parameterType="com.ruoyi.system.domain.house.HouseResourceAssociationObject">
        UPDATE house_resource_association_object
        SET type = #{type,jdbcType=INTEGER},
            house_resource_id = #{houseResourceId,jdbcType=VARCHAR},
            business_id = #{businessId,jdbcType=VARCHAR}
        WHERE id = #{id,jdbcType=VARCHAR}
    </update>

    <delete id="deleteHouseResourceObjectAssociationById" parameterType="String">
        DELETE FROM house_resource_association_object
        WHERE id = #{id}
    </delete>
    <delete id="deleteByHouseResourceId">
        DELETE FROM house_resource_association_object
        WHERE house_resource_id = #{houseResourceId}
    </delete>

    <select id="selectHouseResourceObjectAssociationByHouseResourceIdType"
            resultType="com.ruoyi.system.domain.house.HouseResourceAssociationObject">
        SELECT id, type, house_resource_id, business_id from house_resource_association_object  WHERE house_resource_id = #{houseResourceId}
    </select>
</mapper>