查询中文/英文询盘id集合

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32601201/article/details/53156059
    /**
     * 查询中文/英文询盘id集合
     */
    public List<Long> getInquiryIds(String language){
        StringBuilder sql = new StringBuilder();
        if(language=="zh"){
            sql.append("select B.object_id from t_inquiry B where B.product_name REGEXP '[吖-座]+'");;
         }else{
            sql.append("select B.object_id from t_inquiry B where B.product_name REGEXP '[A-z]+'");; 
         }
        Query query = getSession().createSQLQuery(sql.toString());
        List<BigInteger> inquiries = query.list();
        List<Long> inquryIds = new ArrayList<>();

        if(inquiries!=null){
            for (BigInteger inquiry : inquiries) {
                inquryIds.add(Long.parseLong(inquiry.toString()));
            }
        }
        return inquryIds;
    }

猜你喜欢

转载自blog.csdn.net/qq_32601201/article/details/53156059