package cn.hnthyy.thmz.mapper.his;

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

import java.util.List;

/**
 * 制造商持久化类
 */
public interface YpZdManufactoryMapper {
    /**
     * 根据制造商code查询名称
     *
     * @param code
     * @return
     */
    @Select("select name from yp_zd_manufactory where code = #{code,jdbcType=VARCHAR}")
    String selectYpZdManufactoryByCode(@Param("code") String code);

    /**
     * 模糊查询制造商
     *
     * @param searchText
     * @return
     */
    @Select("select top 10 * from(SELECT yp_zd_manufactory.code," +
            "       yp_zd_manufactory.name" +
            " FROM yp_zd_manufactory" +
            " where    py_code like '${searchText}%' or" +
            "    d_code  like '${searchText}%'  or" +
            "    code    like '${searchText}%' or" +
            "    name    like '${searchText}%')a")
    List<YpZdManufactory> selectYpZdManufactoryBySearchText(@Param("searchText") String searchText);
}
