<?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.sckw.system.dao.KwsMenuMappingDao">

  <insert id="saveBatch">
    insert into kws_menu_mapping (
      id,
      menu_id,
      mapping_id,
      create_by,
      create_time,
      update_by,
      update_time,
      del_flag,
      status,
      remark
    ) values
    <foreach collection="list" item="item" separator=",">
      (
        #{item.id},
        #{item.menuId},
        #{item.mappingId},
        #{item.createBy},
        #{item.createTime},
        #{item.updateBy},
        #{item.updateTime},
        #{item.delFlag},
        #{item.status},
        #{item.remark}
      )
    </foreach>
  </insert>
  <update id="updateById">
    update kws_menu_mapping
       set menu_id = #{menuId},
           mapping_id = #{mappingId},
           create_by = #{createBy},
           create_time = #{createTime},
           update_by = #{updateBy},
           update_time = #{updateTime},
           del_flag = #{delFlag},
           status = #{status},
           remark = #{remark}
     where id = #{id}
  </update>

  <select id="selectByMenuId" resultType="com.sckw.system.model.KwsMenuMapping">
    select a.* from kws_menu_mapping a where a.menu_id = #{id} and a.del_flag = 0
  </select>

    <select id="selectByMenuIds" resultType="com.sckw.system.model.KwsMenuMapping">
        select a.* from kws_menu_mapping a where a.menu_id in
         <foreach collection="idList" item="item" open="(" close=")" separator=",">
             #{item}
         </foreach>
        and a.del_flag = 0
    </select>

    <select id="selectByMappingIds" resultType="com.sckw.system.model.KwsMenuMapping">
        select a.* from kws_menu_mapping a where a.mapping_id in
        <foreach collection="idList" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
        and a.del_flag = 0
    </select>

</mapper>