<?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.kcim.dao.mapper.AccountingProductMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.kcim.dao.model.AccountingProduct" id="accountingProductMap">
        <result property="id" column="id"/>
        <result property="hospId" column="hosp_id"/>
        <result property="accountingId" column="accounting_id"/>
        <result property="productId" column="product_id"/>
        <result property="createTime" column="create_time"/>
        <result property="deleteTime" column="delete_time"/>
    </resultMap>
    <select id="selectProductMap" resultType="com.kcim.vo.ProductMapVO">
        select a.accounting_id,
               b.id,
               b.product_name,
               b.product_code
        from cost_accounting_product a
        LEFT JOIN cost_product b
            on a.product_id = b.id
        where a.delete_time = 0
          and b.delete_time = 0
          and a.hosp_id = #{hospId}
          and b.hosp_id = #{hospId}
        and accounting_id in
        <foreach collection="accountIds" item="accountingId" index="index" open="(" close=")" separator=",">
            #{accountingId}
        </foreach>
    </select>


</mapper>