<?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.yfd.platform.modules.storage.mapper.StorageSourceConfigMapper">
    <resultMap id="BaseResultMap" type="com.yfd.platform.modules.storage.model.entity.StorageSourceConfig">
        <!--@mbg.generated-->
        <!--@Table fi_storage_source_config-->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="type" jdbcType="LONGVARCHAR" property="type"/>
        <result column="title" jdbcType="VARCHAR" property="title"/>
        <result column="storage_id" jdbcType="INTEGER" property="storageId"/>
        <result column="value" jdbcType="LONGVARCHAR" property="value"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, `name`, `type`, title, storage_id, `value`
    </sql>

<!--auto generated by MybatisCodeHelper on 2021-07-15-->
    <select id="findByTypeOrderById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from fi_storage_source_config
        where `type`=#{type,jdbcType=LONGVARCHAR} order by id
    </select>

<!--auto generated by MybatisCodeHelper on 2021-07-15-->
    <select id="findByStorageIdOrderById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from fi_storage_source_config
        where storage_id=#{storageId,jdbcType=INTEGER} order by id
    </select>

<!--auto generated by MybatisCodeHelper on 2021-07-15-->
    <delete id="deleteByStorageId">
        delete from fi_storage_source_config
        where storage_id=#{storageId,jdbcType=INTEGER}
    </delete>

<!--auto generated by MybatisCodeHelper on 2021-07-15-->
    <insert id="insertList" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO fi_storage_source_config(
        name,
        type,
        title,
        storage_id,
        value
        )VALUES
        <foreach collection="list" item="element" index="index" separator=",">
            (
            #{element.name,jdbcType=VARCHAR},
            #{element.type,jdbcType=LONGVARCHAR},
            #{element.title,jdbcType=VARCHAR},
            #{element.storageId,jdbcType=INTEGER},
            #{element.value,jdbcType=LONGVARCHAR}
            )
        </foreach>
    </insert>
</mapper>
