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

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

import java.util.List;

public interface MzZdSupplyTypeMapper {
    /**
     * 根据编码查询门诊给药方式字典信息
     *
     * @param code
     * @return
     */
    @Select("select rtrim(supply_code) supply_code,rtrim(supply_name) supply_name,rtrim(del_flag) del_flag,sort_code,rtrim(class_code) class_code,rtrim(print_name) print_name" +
            ",rtrim(py_code) py_code,rtrim(d_code) wb_code,rtrim(child_code) child_code,rtrim(try_flag) try_flag from mz_zd_supply_type where supply_code = #{code,jdbcType=VARCHAR}")
    MzZdSupplyType selectMzZdSupplyTypeByCode(@Param("code") String code);

    /**
     * 根据编码集合查询门诊给药方式字典列表
     *
     * @param codes
     * @return
     */
    @Select({"<script>",
            "select rtrim(supply_code) supply_code,rtrim(supply_name) supply_name,rtrim(del_flag) del_flag,sort_code,rtrim(class_code) class_code,rtrim(print_name) print_name",
            ",rtrim(py_code) py_code,rtrim(d_code) wb_code,rtrim(child_code) child_code,rtrim(try_flag) try_flag from mz_zd_supply_type",
            "<when test='codes!=null'>",
            " where supply_code in",
            "<foreach item='item' index='index' collection='codes' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</when>",
            "</script>"})
    List<MzZdSupplyType> selectMzZdSupplyTypeByCodeList(@Param("codes") String codes);
}
