<?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.CostAccountShareMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.kcim.dao.model.CostAccountShare" id="costAccountShareMap">
        <result property="id" column="id"/>
        <result property="responsibilityId" column="responsibility_id"/>
        <result property="shareLevel" column="share_level"/>
        <result property="responsibilityCode" column="responsibility_code"/>
        <result property="responsibilityName" column="responsibility_name"/>
        <result property="hospId" column="hosp_id"/>
        <result property="accountingIds" column="accounting_ids"/>
        <result property="accountingNames" column="accounting_names"/>
        <result property="accountingCodes" column="accounting_codes"/>
        <result property="paramList" column="param_list"/>
        <result property="alias" column="alias"/>
        <result property="isShareCost" column="is_share_cost"/>
        <result property="costNode" column="cost_node"/>
        <result property="createTime" column="create_time"/>
        <result property="deleteTime" column="delete_time"/>
    </resultMap>
    <select id="getResponsibilityIdsByAccountId" resultType="java.lang.Long">

        <foreach collection="accountIdList" item="item" separator="," open="(" close=")" index="index">
            select distinct  responsibility_id
            from cost_account_share
            where delete_time=0 and
             (accounting_ids LIKE CONCAT( #{item}, ",", "%" )
            OR accounting_ids LIKE CONCAT( #{item} )
            OR accounting_ids LIKE CONCAT( "%",",",  #{item} )
            OR accounting_ids LIKE CONCAT("%",",",#{item},",","%"))
        </foreach>
    </select>


</mapper>