package cn.hnthyy.thmz.mapper.his.mz;

import cn.hnthyy.thmz.entity.his.mz.JcZdItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface JcZdItemMapper {

    /**根据单个检查字典查询收费编码
     * @param code
     * @return
     */
    @Select("select rtrim(code) code,name,rtrim(class) class_code,py_code,d_code wb_code,rtrim(del_flag) del_flag,rtrim(exec_unit) exec_unit,rtrim(tj_flag) tj_flag," +
            "rtrim(zy_flag) zy_flag,zy_order_code,rtrim(mz_flag) mz_flag,mz_code,bw_code,group_code from jc_zd_item where code=#{code,jdbcType=CHAR}")
    JcZdItem selectJcZdItemByCode(@Param("code") String code);

    /**
     * 根据检查字典集合查询所含的收费编码集合
     * @param codes
     * @return
     */
    @Select({"<script>",
            "select rtrim(code) code,name,rtrim(class) class_code,py_code,d_code wb_code,rtrim(del_flag) del_flag,rtrim(exec_unit) exec_unit,rtrim(tj_flag) tj_flag," +
                    "rtrim(zy_flag) zy_flag,zy_order_code,rtrim(mz_flag) mz_flag,mz_code,bw_code,group_code from jc_zd_item ",
            "<when test='codes!=null'>",
            " where code in",
            "<foreach item='item' index='index' collection='codes' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</when>",
            "</script>"})
    List<JcZdItem> selectJcZdItemByCodeList(@Param("codes") List<String> codes);

}
