<?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.casic.missiles.mapper.equipment.EquipmentStandardSupportMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.model.equipment.EquipmentStandardSupportEquipment">
        <id column="id" property="id" />
        <result column="standard_equipment_id" property="standardEquipmentId" />
        <result column="equipment_id" property="equipmentId" />
        <result column="remark" property="remark" />
        <result column="is_del" property="isDel" />
        <result column="create_user" property="createUser" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, standard_equipment_id, equipment_id, remark, is_del, create_user, create_time, update_time
    </sql>

    <select id="selectBatchEquipmentIds" resultMap="BaseResultMap">
        SELECT * FROM equipment_standard_support_equipment
        WHERE is_del = 0 AND equipment_id IN
        <foreach collection="supportEquipmentIds" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </select>

    <delete id="deleteByList">
        DELETE FROM equipment_standard_support_equipment
        WHERE is_del = 0
        AND standard_equipment_id = #{standardEquipmentId}
        AND equipment_id IN
        <foreach collection="equipmentStandardApplyEquipments" item="item" index="index" open="(" close=")" separator=",">
            #{item.supportEquipmentId}
        </foreach>
    </delete>
</mapper>
