<?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.ems.mapper.CoChargingConfigRelMapper">
    
    <resultMap type="com.ruoyi.ems.domain.CoChargingConfigRel" id="CoChargingConfigRelResult">
        <result property="priceCfgId"    column="price_cfg_id"    />
        <result property="zoningCode"    column="zoning_code"    />
    </resultMap>

    <sql id="selectAdmCoChargingConfigRelVo">
        select price_cfg_id, zoning_code from adm_co_charging_config_rel
    </sql>

    <select id="selectRelList" parameterType="java.lang.Long" resultMap="CoChargingConfigRelResult">
        <include refid="selectAdmCoChargingConfigRelVo"/>
        where price_cfg_id = #{cfgId}
    </select>

    <insert id="insertRelBatch" parameterType="java.util.List">
        insert into adm_co_charging_config_rel (price_cfg_id, zoning_code)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.priceCfgId}, #{item.zoningCode})
        </foreach>
    </insert>

    <delete id="deleteRel" parameterType="Long">
        delete from adm_co_charging_config_rel where price_cfg_id = #{cfgId}
    </delete>
</mapper>