package thyyxxk.webserver.dao.his.yp;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.yp.YpZdGroupName;

import java.util.List;

@Mapper
public interface YpZdGroupNameDao extends BaseMapper<YpZdGroupName> {

    @Select(" select gn.group_name as name, gn.group_no as code from yp_zd_group_name as gn " +
            " where gn.yf_flag = #{yfFlag} and (gn.group_no like '%${text}%' or gn.group_name like '%${text}%' " +
            " or gn.py_code like ('%' + upper(#{text}) + '%') or gn.d_code like ('%' + upper(#{text}) + '%')) " +
            " order by gn.group_no ")
    List<CodeName> selectYpGroupNameByYfFlag(String text, String yfFlag);

    @Select(" select gn.group_name as name, gn.group_no as code, gn.yf_flag as statusFlag from yp_zd_group_name as gn " +
            " where (gn.group_no like '%${text}%' or gn.group_name like '%${text}%' " +
            " or gn.py_code like ('%' + upper(#{text}) + '%') or gn.d_code like ('%' + upper(#{text}) + '%')) " +
            " order by gn.group_no ")
    List<CodeName> selectYpGroupNameAll(String text);


}
