<?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.bonus.canteen.core.drp.mapper.DrpWarehouseFetchUserMapper">

    <select id="getFetchUserByWareHouseIdList" resultType="com.bonus.canteen.core.drp.vo.DrpWarehouseFetchUserVO">
        select
        dwfu.*,
        ac.canteen_name,
        ast.stall_name,
        if(mu.real_name is null or mu.real_name = '', mu.username, mu.real_name) fetchUserName
        from drp_warehouse_fetch_user dwfu
                 left join drp_warehouse dw on dwfu.warehouse_id = dw.warehouse_id
                 left join alloc_canteen ac on dwfu.canteen_id = ac.canteen_id
                 left join alloc_stall ast on dwfu.stall_id = ast.stall_id
                 left join mgr_user mu on dwfu.fetch_user_id = mu.user_id
        where dwfu.warehouse_id in
        <foreach collection="warehouseIdList" item="warehouseId" open="(" close=")" separator=",">
            #{warehouseId}
        </foreach>
    </select>
</mapper>
