string hql = "select p.WarehouseCode,p.WarehouseName,p.MnemonicCode“……
if (!string.IsNullOrEmpty(mnemonicCode))
{
hql += "and p.MnemonicCode like @mnemonicCode ";
}
if (!string.IsNullOrEmpty(mnemonicCode))
{
query.SetParameter("@mnemonicCode","%"+ mnemonicCode +"%");
}
这样写提示找不到字段