package cn.hnthyy.thmz.mapper.his;

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

import java.util.List;

public interface YpZdDictMapper {
    /**
     * 根据药品编码和规格查询药品信息
     *
     * @param code
     * @return
     */
    @Select("select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type from yp_zd_dict where code = #{code,jdbcType=VARCHAR} and serial = #{serial}")
    YpZdDict selectYpZdDictByCodeAndSerial(@Param("code") String code,@Param("serial") String serial);

    /**
     * 根据药品编码集合查询药品字典列表
     *
     * @param codes
     * @return
     */
    @Select({"<script>",
            "select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type from yp_zd_dict",
            "<when test='codes!=null'>",
            " where code in",
            "<foreach item='item' index='index' collection='codes' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</when>",
            "</script>"})
    List<YpZdDict> selectYpZdDictByCodeList(@Param("codes") String codes);



    /**
     * 根据药品编码查询药品信息
     *
     * @param code
     * @return
     */
    @Select("select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type from yp_zd_dict where code = #{code,jdbcType=VARCHAR} ")
    List<YpZdDict> selectYpZdDictByCode(@Param("code") String code);
}
